greatest of 3 numbers using classes and functions.

greatest of 3 numbers using classes and functions.

WAP to calculate greatest of 3 numbers using classes and functions with parameters through input in main?

View Answers

February 21, 2011 at 12:18 PM

Java Find Largest Number

import java.util.*;
class  FindLargest{
    public static void main(String[] args){
        int max = Integer.MIN_VALUE;
        System.out.println("Enter 3 numbers:");
        Scanner input=new Scanner(System.in);

        for(int i=1;i<=3;i++){
            int num=input.nextInt();
            if (num > max) {
                max = num;
               }
         }
        System.out.println("Largest Number is: "+max);
    }
}

February 21, 2011 at 10:00 PM

Thanks for ur help ..









Related Tutorials/Questions & Answers:
greatest of 3 numbers using classes and functions.
greatest of 3 numbers using classes and functions.  WAP to calculate greatest of 3 numbers using classes and functions with parameters through input..._VALUE; System.out.println("Enter 3 numbers:"); Scanner input
Creating objects for classes and calling functions of a dll file using JNI
Creating objects for classes and calling functions of a dll file using JNI .... In this file, some c++ classes and functions are available. How can we create objects for these classes and how can we call these functions by using JNI. Am
Advertisements
convert numbers to strings using JavaScript
convert numbers to strings using JavaScript  How to convert numbers to strings using JavaScript
print 100 numbers using loops
print 100 numbers using loops  how to print from 1 to 100 using for loop ?   Hi Friend, You can use the following code:ADS_TO_REPLACE_1... Numbers { public satic void main(string args[]_ { for(int a=1;a<
add tow numbers with out using arthamatic operaters
add tow numbers with out using arthamatic operaters  add tow numbers with out using arthamatic operaters
Lost Using Swing Components(3)
Lost Using Swing Components(3)  Hello, I sound like every other newbie but I desperately need help. I have to write an application for the WebBuy Company that allows a user to compose the three parts of a complete email message
adding two numbers using bitwise operators
adding two numbers using bitwise operators  adding two integer numbers with using bitwise opeators   Hi Friend, Try the following code: public class AddNumberUsingBitwiseOperators { public static void main(String
adding two numbers with out using any operator
adding two numbers with out using any operator  how to add two numbers with out using any operator   import java.math.*; class AddNumbers { public static void main(String[] args) { BigInteger num1=new
3 dropdown list from the database using JSP
3 dropdown list from the database using JSP  Hi, I'm new to JSP I want to create 3 dropdown list each depend on the other and get the options from the database using JSP
without using built-in functions
without using built-in functions  Hai sir... Please help me to solve this... Findout occurances of each string in every another string (built - in functions are not at all allowed) all, and, sand, falling wall and sand
Find HCF of three numbers in Java Program
Enter Number 2: 14 Enter Number 3: 28 HCF of three numbers 7,14...Find HCF of three numbers in Java Program In this java tutorial section, you will learn how to determine the HCF (Highest Common Factor) or GCD (Greatest
Math Constants and Functions using JavaScript
Math Constants and Functions using JavaScript  What's Math Constants and Functions using JavaScript
associate functions with objects using JavaScript
associate functions with objects using JavaScript  How to associate functions with objects using JavaScript
Java find prime numbers without using break statement
Java find prime numbers without using break statement In this tutorial, you will learn how to find the prime numbers without using break statement. You all...(number); } } } Output: Prime Numbers between 1 and 50: 2 3 5 7 11 13
Sum of two numbers using command line arguments in Java
Sum of two numbers using command line arguments in Java  Hi, How...? The calculate the sum of two numbers using command line arguments in Java... sum = a+b; Check complete example code at Add Two Numbers in Java. Thanks
3
to this output stream using the specified format string and arguments
Spring MVC and Hibernate with DWR 3 -- Configuration Using MySQL Database
Spring MVC and Hibernate with DWR 3 -- Configuration Using MySQL Database  How to configure Spring MVC and Hibernate with DWR 3, Simple example -- reading a table, editing-deleting and adding new rows
To find first two maximum numbers in an array,using single loop without sorting array.
To find first two maximum numbers in an array,using single loop without sorting array.  Java program to find first two maximum numbers in an array,using single loop without sorting array
To find first two maximum numbers in an array,using single loop without sorting array.
To find first two maximum numbers in an array,using single loop without sorting array.  Java program to find first two maximum numbers in an array,using single loop without sorting array
ask user how many numbers to be inputted and determine the sum and highest number using an array in java
ask user how many numbers to be inputted and determine the sum and highest number using an array in java  ask user how many numbers to be inputted and determine the sum and highest number using an array in java
linking jsp with database using classes and methods and then access them all in to my jsp page - JSP-Servlet
linking jsp with database using classes and methods and then access them all in to my jsp page  how to connect jsp page with mysql using classes... to write down the classes and methods in the different folder and then call them
Swapping of two numbers without using third variable
Swapping of two numbers without using third variable In this tutorial we will learn about swapping of two number in java without using third variable. This is simple program to swap two value using arithmetic operation Swapping of two
Rational Numbers
Rational Numbers   Write and fully test a class that represents rational numbers. A rational number can be represented as the ratio of two integer... integers x and y, that is, their greatest common divisor. For example, the greatest
how to display nth greatest salary - SQL
how to display nth greatest salary  how to display nth greatest salary
Program using String functions - Java Beginners
Program using String functions  Write a program to accept a sentence and find out how many times the word "the" occurs?  Hi Friend, Try the following code: import java.util.*; class CountSameWords
Swap two numbers without using third variable
Swap two numbers without using third variable In this section we are going to swap two variables without using the third variable. For this, we have used... from the command prompt. Instead of using temporary variable, we have done some
Add Complex Numbers Java
How to Add Complex Numbers Java In this Java tutorial section, you will learn how to add complex Numbers in Java Programming Language. As you are already aware of Complex numbers. It is composed of two part - a real part and an imaginary
Numbers pyramid
Numbers pyramid  Hi sir, Can you please tell me how to output this using nested for loops? 1 2, 1 1, 2, 3 4, 3, 2, 1 1, 2, 3, 4, 5 6, 5, 4, 3, 2, 1 1, 2, 3, 4, 5, 6, 7 8, 7, 6, 5, 4, 3, 2, 1 1, 2, 3, 4, 5, 6, 7, 8, 9 10, 9, 8
Calculate the Sum of three Numbers
. In this section you will learn how to calculate the sum of three numbers by using three... Calculate the Sum of Three Numbers   ...; To assign the value of the numbers define a method main. Remember we
Java reverse string without using inbuilt functions
Java reverse string without using inbuilt functions In this tutorial, you will learn how to reverse string without using any inbuilt functions. Here, we have created a method to reverse the string and returns a new string with reverse
automorphic numbers
automorphic numbers  how to find automorphic number in java   Hi Friend, Pleas visit the following link:ADS_TO_REPLACE_1 Automorphic numbers Thanks
sorting numbers
sorting numbers  How to sort the numbers in ascending order   import java.util.*; class SortNumbers{ public static void main(String...=input.nextInt(); list.add(num); } System.out.println("Numbers
numbers
Java classes
Java classes  Which class is extended by all other classes
DAO Classes
DAO Classes  login page code for Dao classes
Prime Numbers
Prime Numbers  Create a complete Java program that allows the user to enter a positive integer n, and which then creates and populates an int array with the first n prime numbers. Your program should then display the contents
Hi, I'm new to JSP I want to create 3 dropdown list each depend on the other and get the options from the database using JSP
Hi, I'm new to JSP I want to create 3 dropdown list each depend on the other and get the options from the database using JSP  as i said i want to create 3 drop dropdown list each depend on the other and get the options from
java classes
java classes  Which class is the super class for all classes in java.lang package
How to put text file numbers to array and check the position of numbers?
How to put text file numbers to array and check the position of numbers?   I have numbers in text file data.txt 12 9 8 3 1
php classes and objects
php classes and objects  using a object with a member method of the class
Listing all even numbers between two numbers
Listing all even numbers between two numbers  Hi, How to write code to list all the even numbers between two given numbers? Thanks   Hi, You function will take 2 numbers and the find the even numbers between
Generate array of random numbers
:ADS_TO_REPLACE_1 Enter 10 numbers: 1 2 3...Generate array of random numbers You can generate a random number either by using the Random class or by using the static method Math.random
wrapper classes
wrapper classes  Explain wrapper classes and their use?   Java Wrapper Class Wrapper class is a wrapper around a primitive data type... of the primitive wrapper classes in Java are immutable i.e. once assigned a value
how to add to numbers in java
how to add to numbers in java  how to add to numbers in java
Swapping of two numbers in java
Swapping of two numbers in java In this example we are going to describe swapping of two numbers in java  without using the third number in java. We... values from the command prompt. The swapping of two numbers is based on simple
how to calculate addition of two distances in feets and inches using objects as functions arguments
how to calculate addition of two distances in feets and inches using objects as functions arguments  how to calculate addition of two distances in feets and inches using objects as functions arguments in java
classes
classes
Inner classes
Inner classes   Hi I am bharat . I am student learning java course . I have one question about inner classes . question is how to access the instance method of Non-static classes which is defined in the outer
classes and objects
classes and objects  Define a class named Doctor whose objects... methods, and an equals method as well. Further, define two classes: Patient... classes a reasonable complement of constructors and accessor methods, and an equals

Ads