An introduction to Java programming for beginners.
Java is one of the most popular programming languages in the world. Let's learn the basics!
- Platform independent (Write Once, Run Anywhere) - Object-oriented - Strong community support - Used in enterprise applications - Android development
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
int age = 20;
String name = "Faizan";
boolean isDeveloper = true;
if (age > 18) {
System.out.println("Adult");
} else {
System.out.println("Minor");
}
// For loop
for (int i = 0; i < 5; i++) {
System.out.println(i);
}// While loop
int count = 0;
while (count < 5) {
System.out.println(count);
count++;
}
public class Person {
String name;
int age;
public void greet() {
System.out.println("Hello, I'm " + name);
}
}// Creating an object
Person p = new Person();
p.name = "Faizan";
p.greet();
Java is a great language to start your programming journey. Practice daily and build small projects!