I even studied "sequential progress," "conditional branching," and "repetition."
Hello.java
class Hello {
public static void main(String[] args){
System.out.println("Hello");
}
}
output
Hello
Variable.java
class variable {
public static void main(String[] arg){
int var = 1;
System.out.println(var);
}
}
output
1
Array.java
class Array{
public static void main(final String[] args) {
int[] arr = new int[] { 8, 12, 21 };
System.out.println("breakfast" + arr[0] + "From time");
System.out.println("lunch" + arr[1] + "From time");
System.out.println("Supper" + arr[2] + "From time");
}
}
output
Breakfast is from 8 o'clock
It's from 12:00 lunch
It's from 21:00 at night
Age.java
class Age{
public static void main(String[] args){
int humidity;
humidity = 50;
if (humidity >= 60){
System.out.println("Humidity" + humidity + "%is");
System.out.println("I'm messy");
}else if((humidity <= 60) && (humidity >= 40)){
System.out.println("Humidity" + humidity + "%is");
System.out.println("Comfortable");
}else if(humidity <= 40) {
System.out.println("Humidity" + humidity + "%is");
System.out.println("I'm crazy");
}
}
}
output
Humidity is 50%
Comfortable
Install JDK and editor VSCode on windows
This article was written with reference to the following information. Kinocode / YouTuber for programming learning videos
Recommended Posts