Progate | Learn to code, learn to be creative.
Progate is an online platform to learn programming. Learn to build your own apps and services.
progate.com
프로게이트에서 자바 강의를 듣고 있다.
이론과 예시를 간단하게 슬라이드로 보여준 후, 바로 직접 코드를 짤 수 있는 예제가 주어져서 부담없이 공부하기 쉽다.
총 6개의 단계로 나눠져 있으며 내 기억으로는 3단계 이후부터는 멤버십을 가입해야 볼 수 있었다.
프로게이트 플러스 멤버십은 달에 $9.99 정도. 자바 외에도 다른 언어가 많아서 조금 더 들어볼 것 같다.
영어로 설명하긴 하지만 굳이 사전을 찾아볼 필요 없이 초간단한 영어만 쓰이니 걱정할 필요도 없고, 개발에 있어서 구글링은 필수이기 때문에(...) 영어 공부도 겸하기에 좋은 것 같다.
매일 강의를 들으며 필기한 것을 정리해 올릴 예정.
"Hello Java" print charachers
class Main {
public static void main(String[] args) {
System.out.println("Hello Java");
}
}
|
cs |
System.out.println( ) is an instruction to print what's inside ( ).
Every Java file has a class. Inside the class, there are methods.
Semicolon at the end of every statement.
주석 달 때는 " // " 사용
Integers no need " "
ex) print the sum of 5 and 3
-> System.out.println( 5 + 3 );
print "5 + 3" as a string
-> System.out.println("5 + 3");
String concatenation
The + that we used for calculations also let us combine strings.
Data type
- String type ("S" must be uppercase) ex) "Hello Java"
- int type ex) 3
Declaring variables
1. Specify the data types
2. Decide the name
ex) int number;
String name;
Assigning values
Initializing variables : declare and assign at the same time
dataType variableName = value
ex ) int number = 3;
System.out.println( number ); -> 3
Concatenating variables
ex) String greeting = "Hello";
System.out.println(greeting + "John"); -> Hello John
Good variable name : lowercase, seperate the words with a capital letter ex) userName
Bad variable name : Don't start with a number, Don't use underscore ex) user_name
When we do calculations with an int and a double, int will be implicitly converted to a double.
You can convert an integer to a double by casting it.
ex ) int number1 = 13;
int number2 = 4;
System.out.println( (double) number1 / number2 ); -> 3.25