일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- 데이터분석전문가
- Joseph Samuel Nye Jr.
- 자료구조
- 공부정리
- KMOOC
- 백준
- 알고리즘
- 미분적분학
- EBS
- K-MOOC
- 누가 진정한 리더인가
- CNN10
- python
- 정치학
- 조지프 나이
- ADsP
- 빅데이터
- MySQL
- 데이터분석전문가가이드
- 맛집
- 코테
- Udemy
- 당신이 몰랐던 진화론
- Hacker Rank
- Great Minds
- ADP
- 후기
- Progate
- 위대한 수업
- Baekjoon
- Today
- Total
ㅇ
JAVA / Progate 본문
- print to Console
System.out.pirntln("~string~")
- variables
String // for letters
int // for numbers
double // for decimal num
//without any quotes for variable-name
data-type variable-name;
variable-name = value;
or
data-type variable-name=value;
- calculation
x = x + 1; -> x +=1; -> x++;
- camelCase
use a variable-name
camel // fine
camelCase //fine
camel_case // is used
a // not descriptive
1name // not start with a num
- cast
(double)number1 / number2;
- boolean
true or false
&&
||
!()
- if
if(condition1) {
// run this code
} else if(condition2) {
// run this code
} else {
// run this code
}
- switch
sitch (value of condition) {
case value1:
// run this code;
break;
case value2:
// run this code;
break;
case value3:
// run this code;
break;
default:
// run this code;
break;
}
- while
while (condition) {
// repeat this code
}
- for
for (initialize the variable; add a condition; upadate the variable) {
// repeat this code
}
- break;
when you want to exit the loop immediately.
- continue;
when you skip the loop for that specific iteration
- array
datatype[] array_name = {~,~,~};
array_name[index] = ~~
// can not assign a value to an element doen't exist
array_name.length // the length of the array
- enhanced for loop
for (type variableName: arrayName) {
// run this code
}
- method
class Main {
public static void Method_Name() {
// run this code
}
}
// call a method
Method_Name()
- arguments
// can have multiple variables. seperate them with ,
public static void Method_Name(data-type variable for reciving an argument) {
// run this code
}
Method_Name(argument)
- return values
//datatype should match the return value
public static datatype methodName(parameter) {
// run this code
return returnValue
}
void : no return value
- class
// call the method where is in the other class
className.methodName()
class className
// capitalized
- libraries
// import lib
import external library
// lib for calculation
import java.lang.Meth
- max
- Math.round(argument) > imported by default
- import java.util.Scanner > scanner
Scanner scanner = new Scanner(System.in)
// make a new Scanner instance
String vaiableName = scanner.next();
// read a string
// method for integers and the decimals
nextInt , nextDouble
- Object-Oriented Programming
new ClassName();
// create an instance of the ClassName class
ClassType varableName = new ClassName();
// assign an instane to variables
public returnValueType methodName() {
// run this code
}
// defining methods
instsanceName.methodName();
// calling instance metohds
- instance
public dataType varableNAme;
//declar instance fields
instanceName.fieldName();
//access instance fileds
- this
this.varible
// only in the body of a method
// this is replaced by the instance
- constructors
// parameters of the constructor
ClassName(dataType variableName) {
// operations to run upon instantiation
}
// give the constructors the same name as its class
// do not write return or void
ClassType varableName = new ClassName();("arguments")
this(~~,~~,~~);
// some argument are duplicated, using this()
- Instances Methods
- class field
public static ~~ = 0
// class field
// set the initial value for a field
public ~~
// instance field
ClassName.classFieldName;
// access class field
- class method
public static returnType methodName() {
//code for the method
}
ClassName.methodName();
- getter
public dataType getFieldName() {
return this.privateFieldValue;
}
- setter
public dataType setFieldName() {
this.privateFieldValue = varableName;
}
- class inheritance
calss SubclassName extends SuperclassName {
// run this code
}
- override
// main calls subclass then, checks superclass
super.methodName();
- abstract method
abstract class ~ {
abstract public void ~(~);
'IT' 카테고리의 다른 글
[제25회 데이터 분석 준전문가(ADsP)/독학/합격후기] (0) | 2020.08.18 |
---|---|
[제37회 SQL 개발자(SQLD)/독학/합격후기] (0) | 2020.08.13 |
JavaScript / Progate (0) | 2020.07.24 |
SQL / Progate (0) | 2020.07.22 |
HTML , CSS / Progate (0) | 2020.07.20 |