Java CS Grade 11
Java CS Grade 11
//A Java Program to demonstrate the use of if-else statement.
//A year is leap, if it is divisible by 4 and 400. But, not by 100.
A year is leap, if it is divisible by 4 and 400. But, not by 100.
public class LeapYearExample {
public static void main(String[] args) {
int year=2020;
if(((year % 4 ==0) && (year % 100 !=0)) || (year % 400==0)){
System.out.println("LEAP YEAR");
}
else{
System.out.println("COMMON YEAR");
}
}
}
Activity-Breakout Room
Date :5th August 2020
Recap java condition and if statement
What is the output of each of the following
code fragments?
Write the condition Statement of the
following
Self evaluation
Java IO : Input-output in Java
Java Program to get input from user
Class practice Session
Example to find greatest number
Output
Class practice Session
Example to take user input
Output
Learning Resource
• https://www.programiz.com/java-programmin
g/scanner
Java MCQ
Java Switch Statements
Break Keyword
Example with or without break statement
Class practice Session