Skip to content

Supercool-Coder/List-of-Java-Programs-for-Practice-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 

Repository files navigation

List-of-Java-Programs-for-Practice-

Java programming exercises: To learn any programming language you have to practice the programs, this is one of the best and faster ways to learn a programming language.

Java is an object oriented programming java that James Gosling designed at Sun Microsystems, Inc.

This webpage contains java programs for practice on various java topics such as Java string programs, control statements, Java Array Programs, Java loops programs, functions, arrays, etc. All the following java programs are tested and provided with the output.

Basic Java programs Practice | Java Coding Practice with examples

Question 1 --> Write a Java program to print ‘Hello World!’ on screen ?

Solution:- image

Question 2 --> Write a Java program to print the sum of two numbers ?

Solution :- image

Question 3 --> Write a Java program that takes two numbers and display the product of two numbers ?

Solution :- image

Question 4 --> Write a Java program to print the sum, multiply, subtract, divide and remainder of two numbers ?

Solution :- image

Question 5 --> Write a Java program that takes five numbers as input to calculate and print the average of the numbers ?

Solution :- image

Question 6 --> Write a Java program to swap two variables ?

Solution :- image

Question 7 --> Write a Java program to convert a decimal number to binary numbers ?

Solution :-

Question 8 --> Write a Java program to convert a binary number to decimal number ?

Solution :-

Question 9 --> Write a Java program to check whether Java is installed on your computer or not ?

Solution :-

Question 10 --> Write a Java program and compute the sum of the digits of an integer ?

Solution :-

Question 11 --> Write a Java program to compare two numbers ?

Solution :-

Question 12 --> Write a Java program to count the letters, spaces, numbers and other characters of an input string ?

Solution :-

Question 13 --> Write a Java program to print the ascii value of a given character ?

Solution :-

Question 14 --> Write a Java program that accepts an integer (n) and computes the value of n+nn+nnn ?

Solution :-

Question 15 --> Write a Java program to display the system time ?

Solution :-

Question 16 --> Write a Java program to print the odd numbers from 1 to 20 ?

Solution :-

Question 17 --> Write a Java program to print the even numbers from 1 to 20 ?

Solution :-

Question 18 --> Write a Java program to convert a string to an integer ?

Solution :-

Question 19 --> Write a Java program to convert seconds to hour, minute and seconds ?

Solution :-

Question 20 --> Write a Java program to compute the sum of the first 100 prime numbers ?

Solution :-

Question 21 --> Write a Java program to swap the first and last elements of an array and create a new array ?

Solution :-

Question 22 --> Write a Java program to count the number of even and odd elements in a given array ?

Solution :-

Question 23 --> Write a Java program to compute the square root of an given integer ?

Solution :-

Question 24 --> Write a Java program to check if a positive number is a palindrome or not ?

Solution :-

Question 25 --> Write a Java program to add two numbers without using any arithmetic operators ?

Solution :-

Question 26 --> Write a Java program to add all the digits of a given positive integer ?

Solution :-