Find Bigger and Smaller number by Java Programming

  • on February 4, 2019
  • Likes!
Hello friends! Welcome to my website
Java programming to find the bigger and smaller number between two numbers?
This java language programming is free all type of errors like compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with the output. This programming output is customized to understand easily.

Program to print the bigger and smaller number between two numbers in java

import java.util.Scanner;

class test3 {

    int a, b;

    public void bigger(int a, int b) {
        if (a > b) {
            System.out.println(a + ” is bigger than ” + b);
        } else {
            System.out.println(b + ” is bigger than ” + a);

    public void smaller(int a, int b) {
        if (a < b) {
            System.out.println(a + ” is smaller than ” + b);
        } else {
            System.out.println(b + ” is smaller than ” + a);

public class largest_smallest {

    public static void main(String args[]) {
        Scanner c = new Scanner(;
        test3 o = new test3();
        System.out.print(“Enter the Frist Number: “);
        o.a = c.nextInt();
        System.out.print(“Enter the Second Number: “);
        o.b = c.nextInt();
        System.out.println(“The Result of the Programming”);
        o.bigger(o.a, o.b);
        o.smaller(o.a, o.b);

Enter the Frist Number: 45
Enter the Second Number: 54
The Result of the Programming
54 is bigger than 45
45 is smaller than 54

I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any dought about this java programming code or input & output please comment below
If you have other question about java programming send an email by contacting us form are given on page right side.

Please share your experience about this post,
Thank You!

Article Categories:
Programs in java

Leave a Reply

Your email address will not be published. Required fields are marked *