class How to write a class.
setumeiclass.java
public class setumeiclass/*⇐ File name*/{
//Write the main method in this.
}
It won't start without this. Write the code in this. (Basically.)
Test.java
public class Test{
  public static void main(String args[]){
	/*Write the code here!!*/
  }
}
rei.java
public class rei{
  public static void main(String args[]){
    System.out.println("Hello,World!!");
  }
}
Hello,World!!
zisaku
public class zisaku{
public static typename method(argument){
Code executed by this method
	}
	public static void main(String args[]){
Use your own method here
	}
 
}
myclass.java
public class myclass{
	public static void main(String args[]){
		myclass(1,2); 
	}
	public static void myclass(int a,int b){
		System.out.println(a+b);
	}
}
3
Since the values of the arguments ʻa and bofmyclass are 1 and 2, ʻa + b (1 + 2) is 3.
Recommended Posts