Java Basic Tutorial

Java for Beginners

Pages

  • Home
  • Basics
  • Exercises

Exercises


Java Basic Exercises with solution

Hello world program

Display your name, your age and your city name

How to convert from Fahrenheit to Celsius and from Celsius to Fahrenheit temperature

How to calculate the area of rectangle

How to calculate the area of triangle

How to calculate the diameter, circumference and area of circle

How to check whether a number is even or odd

How to calculate the hypotenuse of a right triangle

How to swap two numbers with and without a temp variable

How to check a leap year

Factorial of a number

Java factorial using recursion

How to check prime numbers

How to get current date and time

Rectangle made of asterisks

Pyramid pattern

Arithmetic operators


 

No comments :

Post a Comment

Home
Subscribe to: Posts ( Atom )

Popular Posts

  • Java program to calculate the hypotenuse of a right triangle
    How to find the length of the hypotenuse in Java This program uses the Pythagoras theorem to calculate the length of the hypotenuse of a r...
  • Java program to convert celsius to fahrenheit
    How to convert celsius to fahrenheit in java This Java program is about the temperature conversion from Celsius to Fahrenheit. The prog...
  • Java program to calculate the diameter, circumference and area of circle
    The program asks the user to enter the radius of a circle and finds  the diameter, circumference and area.  Diameter, area and circumferen...
  • Java program to swap two numbers with and without a third variable
    In this post we explain two methods to swap two numbers in Java. Method 1: swapping two numbers using a third variable Method 2: swap...
  • Java program to calculate the area of rectangle
    How to calculate the area of a rectangle The area of a rectangle is equal to the length multiplied by the width. The program asks the use...
  • Java program to check leap year
    Java program to check if a given year is leap year A leap year is a year with an extra day. Leap year contains 366 days instead of 365. T...
  • Java Factorial using recursion example
    Java program to find factorial of a number using recursion. This Java method gets and integer number n and returns n factorial using recur...
  • Pyramid pattern in Java
    How to print pyramid pattern in Java Java code to create star pyramid pattern using nested loops. This is a common programming problem f...
  • How to check prime numbers in Java
    Java program to check if a given number is prime or not. This Java method takes an integer n and returns a boolean value. The isPrime metho...
  • Display your name, age and city name
    How to display your name, age and city name in Java Write a program to display your name, your age and your city name on screen in three di...
Powered by Blogger.