Compare Java with C++
Compare Java with Java Script
Analyze a class (Main.java)
package com.example;
public class Main() {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
Java Command
- java: runtime
- javac: compiler
- javadoc: docs builder
- jar: archive builder
javac Main.java --> generate Main.class
java Main ---> run Main.class --> output: Hello World
Identifier Conventions
- Class start with uppercase character: class MyClass
- Methods and variables start with lowercase character:void doSomething(String withThis) {}
- Constants are full uppercase:final String FIRSTNAME = "David";
Compare Java with C++
Compare Java with Java Script
Analyze a class (Main.java)
package com.example;
public class Main() {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
Java Command
- java: runtime
- javac: compiler
- javadoc: docs builder
- jar: archive builder
javac Main.java --> generate Main.class
java Main ---> run Main.class --> output: Hello World
Identifier Conventions
- Class start with uppercase character: class MyClass
- Methods and variables start with lowercase character:void doSomething(String withThis) {}
- Constants are full uppercase:final String FIRSTNAME = "David";
Compare Java with C++
Compare Java with Java Script
Analyze a class (Main.java)
package com.example;
public class Main() {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
Java Command
- java: runtime
- javac: compiler
- javadoc: docs builder
- jar: archive builder
javac Main.java --> generate Main.class
java Main ---> run Main.class --> output: Hello World
Identifier Conventions
- Class start with uppercase character: class MyClass
- Methods and variables start with lowercase character:void doSomething(String withThis) {}
- Constants are full uppercase:final String FIRSTNAME = "David";