Really really need some help!!

Can some one please assist me with getting this program started:

Write a program called that asks the user for how many numbers that they have. Then use a for loop that loops that number of times. In the loop, ask the user for a number. Keep track of what the largest number entered is. Print that out after the loop is over.


  • import*;

    class Largest {
    public static void main(String[] args)
    throws {
    int n1=0,n2=0,temp=0;
    Scanner kbd = new Scanner(;

    System.out.println("Enter Your First Number:");
    n1 = kbd.nextInt();

    for(int i=0; itemp)
    System.out.println("largest = " + temp);

    hope this will work for u.

  • Thanks so much. Perhaps you could explain the 'kbd' portion, why didnt you call it Scanner 'scan'? What does the 'throws{ ' mean?

    If you get time, it would help me learn.

    Thank you
  • 'kbd' is just an object of Scanner. u can name it whatever u like.

    'throws' is a technique for exception handling. u r getting input from keyboard if any case ur program is not getting that input then it will throw the IO Exception.

    Good luck!!

  • keep posting!!!

  • [b][/b][size=5]Gud... is scanner a predefined object.. we normally use Bufferedreader or InputStream to get an inputstream. This seems to be new.It would be grt,if Could you pls explain on this (Scanner).[/size][/size]
  • This post has been deleted.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!