Java Basic Programs, JAVA Tutorials

JAVA Basic Programs With Solutions

JAVA Basic Programs

Hello friends, welcome to Tech Naandi Solutions. Java has become the most popular and best programming language in the software industry. In this post, we will learn the top 5 JAVA Basic Programs.

We are here to help you to learn JAVA programming language, on our website we will provide all tutorials that you need to learn JAVA.

In this post, I am providing you the most important and basic programs for you, which help you to get the basic knowledge about JAVA programming.

I restricted copying of programs from my website because if you copy and paste these programs you won’t get knowledge of programming, try to type and learn programs 😊

The sum of two numbers in JAVA using Scanner Class

Example 1: Sum of Two Numbers

Output : Sum of two numbers is : 50

Example 2: Sum of Two Numbers Using Scanner Class

Output : 

Enter Number 1 : 75

Enter Number 2: 25

Sum of two numbers is : 100

JAVA Program to check Even or Odd Number

What is Even Number 

Even numbers are the numbers, that are exactly divisible by 2.All even numbers ends with 2,4,6,8 numbers, we can say that the number 234567894 is an even number because its ends with 2.😊

What is Odd Number 

Odd numbers are the numbers, that are not exactly divisible by 2.All odd numbers ends with 1,3,7,9, numbers, we can say that the number 2345678949 is an even number because it ends with 9.😊

Example Program

Output 1:

Enter Any Number: 344568

The Given number is Even

Output 2:

Enter Any Number: 3445689

The Given number is ODD

JAVA Program to check Leap Year

What is Leap Year

We all know that a common year has 365 days, but a leap year contains 366 days by adding a 1 extra day to the month of February. A leap year comes once every 4 years.

We use simple logic to find a leap year is that if any year that is exactly divided by 4, then we can call it as a leap year.

Leap Year Program

Output 1:

Enter Any Year: 2020

2020 is a leap year

Output 2 :

Enter Any Year: 2002

2002 is not a leap year

Java program to find Vowel or consonant

What are Vowel and consonant

Before going to program let us see what are these vowels and consonants. In an English Alphabets A E I O U are called as vowels and remaining alphabets are called as consonants

Now we are going to write a Java program to find the given alphabet is vowel or consonant by using switch case.

Program to find Vowel or Consonant

Output 1:

Enter Any Alphabet: A

A is a Vowel

Output 2:

Enter Any Alphabet: N

N is a Consonant

Output 3:

Enter Any Alphabet: 4

Please Enter only Alphabets

Write a JAVA program to find given STRING is Palindrome or not

What is Palindrome 

A palindrome is nothing but a string or a number will remain the same even if you reverse the string/number.



Madam, Level, POP,………………………….

OutPut :

Enter Any String: MADAM

MADAM is a Palindrome = true

Thanks for your support we will provide more tricks & tips for you. If you like our tricks, share these with your friends and join my Telegram Channel for more new tricks & tips.


About Narendra Anja

Hi, My name is Narendra I started my carrier with JAVA technology and later on moved into the PEGA platform. I have started this website to share my knowledge with you, I will post all technologies related content with you on this website

10 thoughts on “JAVA Basic Programs With Solutions

  1. Netflix says:

    These are actually great ideas about blogging.
    You have touched on some nice points here. Any way keep up writing.


    iam very happy to learn this website for java learner bro

    1. Hi Bro

      Thank You, I will provide more concepts very soon.

  3. Leonrad Garcia says:

    Hi, this is Leonard.

    Today I have Visited your site, very nice design and contain very useful Content, keep posting more topics.

    Thank you
    Leonard Garcia.

    1. Hi Leonard,

      Thanks for your support.

  4. Vikram says:

    It’s very helpful for me bro, keep posting more programs

    1. Thanks for your support.

  5. Somasekhar masala says:

    Seriously it was nice & proud of you Narendra good website with and simple programs & algorithms, keep it up, and all the best for more concepts coming up.

    1. Thanks for your support Somasekhar.I will come up with more useful content to help my users.

Comments are closed.