0% found this document useful (0 votes)
9 views

Java

java practical insights for NCERT

Uploaded by

abigailkuzhi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Java

java practical insights for NCERT

Uploaded by

abigailkuzhi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

JAVA

PROGRAMS

1
INDEX

JAVA PROGRAMS

1. To print “Hello World”..................................................................................................3


2. To write a program to identify if a number is positive or negative.........................4
3. To write a program in java to display the largest number among the given three
numbers...........................................................................................................................5
4. To write a java program and identify if the number is even or odd........................6
5. To write a java program and generate the multiples of the given number upto 10
iterations..........................................................................................................................7
6. To write a program in java to display the alphabet series........................................8
7. To calculate and print the factorial of a given number by while loop and for
loop...................................................................................................................................9
8. To create two options of class Triangle, compute their area, and compare their
area and colour and if area and colour both are same for the objects then display
“Identical Triangles” otherwise display “Non Identical”.....................................10
9. To write a program to manipulate a given string....................................................12
10. To write a program to sort a string array and arrange it in alphabetical series. 13
11. To print the fibonacci series for a given number.....................................................15
12. To print all the prime numbers between a given range..........................................16
13. To write a program to implement a basic calculator to perform the functions of
addition, subtraction, division and multiplication.................................................17

2
Java Program 1

Aim:

To print “Hello World”.

Syntax

Output

3
Java Program 2

Aim:

To write a program to identify if a number is positive or negative.

Syntax

Output

4
Java Program 3

Aim:

To write a program in java to display the largest number among the


given three numbers.

Syntax

Output

5
Java Program 4

Aim:

To write a java program and identify if the number is even or


odd.

Syntax

Output

6
Java Program 5

Aim:

To write a java program and generate the multiples of the given


number upto 10 iterations.

Syntax

Output

7
Java Program 6

Aim:

To write a program in java to display the alphabet series.

Syntax

Output

8
Java Program 7

Aim:

To calculate and print the factorial of a given number by while loop


and for loop.

Syntax

Output

9
Java Program 8

Aim:

To create two options of class Triangle, compute their area, and


compare their area and colour and if area and colour both are same
for the objects then display “Identical Triangles” otherwise display
“Non Identical”.

Syntax

10
Output

11
Java Program 9

Aim:

To write a program to manipulate a given string.

Syntax

Output

12
Java Program 10

Aim:

To write a program to sort a string array and arrange it in


alphabetical series.

Syntax

Output

13
14
Java Program 11

Aim:

To print the Fibonacci series for a given number

Syntax

Output

15
Java Program 12

Aim:

To print all the prime numbers between a given range.

Syntax

Output

16
Java Program 13

Aim:

To write a program to implement a basic calculator to perform


the functions of addition, subtraction, division and
multiplication.

Syntax

Output

17

You might also like