/*
Determine If Year Is Leap Year Java Example
This Determine If Year Is Leap Year Java Example shows how to determine whether the given year is a leap year or not.
*/
public class DetermineLeapYearExample {
public static void main(String[] args) {
//year we want to check
int year = 2004;
//if year is divisible by 4, it is a leap year
if((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0)))
System.out.println("Year " + year + " is a leap year");
else
System.out.println("Year " + year + " is not a leap year");
}
}
/*
The output of the example would be
The year 2004 is a leap year
*/
Showing posts with label JAVA. Show all posts
Showing posts with label JAVA. Show all posts
Wednesday, November 30, 2016
Tuesday, November 29, 2016
Java Program
Java is a programming language and a platform.
Java is a high level, robust, secured and object-oriented programming language.
Platform: Any hardware or software environment in which a program runs, is known as a platform. Since Java has its own runtime environment (JRE) and API, it is called platform.
Java Example
class Simple{
public static void main(String args[]){
System.out.println("Hello Java");
}
}
TEST (OUTPUT)
x
Subscribe to:
Posts (Atom)