Java Basics
The main method, primitive types, strings and control flow in Java.
Beginner
public class Hello {
public static void main(String[] args) {
int count = 3;
double voltage = 3.3;
String name = "UPEEC";
for (int i = 0; i < count; i++) {
System.out.println(name + " " + voltage);
}
}
}
Primitive types: byte, short, int, long, float, double, char, boolean. Everything else is an object. Compare strings with .equals(), not ==.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.