0% found this document useful (0 votes)
2 views1 page

Java Simple

The document contains three Java programs: 'HelloWorld' which prints 'Hello, World!', 'AddNumbers' which calculates and prints the sum of two integers, and 'EvenOdd' which checks if a number is even or odd and prints the result. Each program demonstrates basic programming concepts in Java. The examples are simple and serve as introductory exercises for beginners.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Java Simple

The document contains three Java programs: 'HelloWorld' which prints 'Hello, World!', 'AddNumbers' which calculates and prints the sum of two integers, and 'EvenOdd' which checks if a number is even or odd and prints the result. Each program demonstrates basic programming concepts in Java. The examples are simple and serve as introductory exercises for beginners.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

Hello World
class HelloWorld {
public static void main(String[] args) {
[Link]("Hello, World!");
}
}

2. Add Two Numbers


class AddNumbers {
public static void main(String[] args) {
int a = 10;
int b = 20;

int sum = a + b;

[Link]("Sum = " + sum);


}
}

3. Check Even or Odd


class EvenOdd {
public static void main(String[] args) {
int number = 7;

if (number % 2 == 0) {
[Link]("Even Number");
} else {
[Link]("Odd Number");
}
}
}

You might also like