how can we declare class in java code example
Example 1: how to make a class in java
public class Main {
public static void main (String[] args) {
System.out.println("Hello World");
}
}
Example 2: using class in java
public class HelloWorld {
public static void main(String[] args) {
// how to use class in java
class User{
int score;
}
User dave = new User();
dave.score = 20;
System.out.println(dave.score);
}
}