Intermediate Java
Jim White
Java Developer
returnType methodName(){
// Code to be run
}
void znamená nicvoid sayHello(){
System.out.println("Hello there!");
}
int nebo Stringreturnint getSquare() {
return 5 * 5
}
Lower camel case
getSquare()sayHello()Java rozlišuje velká a malá písmena!
Pokud se metoda jmenuje getSquare(), getsquare() nebude fungovat!
"JAVA".toLowerCase();sayHello();
"Hello there!"
class HelloMethod {
public static void main (String[] args) {
sayHello();
int fiveSquared = getSquare(); // Saving the result of getSquare() as int
}
static void sayHello() { // Just prints a message
System.out.println("Hello there!");
}
static int getSquare() { // Returns int
return 5*5;
}
}
Hello there!
Intermediate Java