0% found this document useful (0 votes)
5 views2 pages

Java Programming Exercises for Beginners

The document contains a list of 30 Java programming tasks aimed at beginners. These tasks include basic operations like printing messages, performing arithmetic calculations, and manipulating arrays and strings. Each task is designed to enhance programming skills and understanding of Java syntax and concepts.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Java Programming Exercises for Beginners

The document contains a list of 30 Java programming tasks aimed at beginners. These tasks include basic operations like printing messages, performing arithmetic calculations, and manipulating arrays and strings. Each task is designed to enhance programming skills and understanding of Java syntax and concepts.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1.

Write a Java program to print 'Hello' on screen and your name on a


separate line.
2. Write a Java program to print the sum of two numbers.
3. Write a Java program to divide two numbers and print them on the
screen.
4. Write a Java program to print the area and perimeter of a circle.
5. Write a Java program that takes three numbers as input to calculate
and print the average of the numbers.
6. Write a Java program to print the area and perimeter of a rectangle.
7. Write a Java program to swap two variables.
8. Write a Java program to input and display your password.
9. Write a Java program to print odd numbers from 1 to 99. Prints one
number per line.
10. Write a Java program to accept a number and check whether
the number is even or not. Prints 1 if the number is even or 0 if odd.
11. Write a Java program to print numbers between 1 and 100
divisible by 3, 5 and both.
12. Write a Java program to check whether the given integer is a
power of 4 or not.
13. Write a Java program to get a number from the user and print
whether it is positive or negative.
14. Write a Java program that takes three numbers from the user
and prints the greatest number.
15. Write a Java program that takes a number from the user and
generates an integer between 1 and 7. It displays the weekday
name.
16. Write a Java program to display the first 10 natural numbers.
17. Write a program in Java to input 5 numbers from the keyboard
and find their sum and average.
18. Write a Java program to display the cube of the given number
up to an integer.
19. Write a Java program to display the multiplication table of a
given integer.
20. Write a program in Java to make such a pattern like a right
angle triangle with a number which repeats a number in a row.
The pattern is as follows:
1
22
333
4444
21. Write a Java program to find the maximum and minimum
value of an array.
22. Write a Java program to find duplicate values in an array of
integer values.
23. Write a Java program to find the second largest element in an
array.
24. Write a Java program to find the number of even and odd
integers in a given array of integers.
25. Write a java program to calculate simple interest
26. Write a Java program to find occurrence of a character in a
String
27. Write a Java Program to sort an array in ascending order.
28. Write a Java Program to Find Quotient and Remainder
29. Write a Java Program to Calculate Power of a Number
30. Write a Java Program to remove all the white spaces from a
string

You might also like