Home Discussion Discuss: Java Next()

  • next()Flora August 25, 2011 at 7:00 PM

    How do I let user input data on more than 1 line...? without the programe exiting scanner when enter is press, this only has to happen when enter is pressed twice...

  • JavaAinee November 28, 2011 at 8:51 AM

    good material provid by u ..i like it

  • to get by idraj August 20, 2012 at 12:02 AM

    package test; import java.util.ArrayList; import java.util.Scanner; public class employee { public static void main(String[] args) { ArrayList list = new ArrayList(); list.add(new User(4356,"ajay" ,04-01-1990,127090) ); list.add(new User(657432,"sujit" ,14-06-1890,12300) ); list.add(new User(897654,"ramakant",14-07-1890,12800) ); list.add(new User(564322,"tom",01-21-1870,82600) ); System.out.print("Enter UserId: "); Scanner input=new Scanner(System.in); int UserId = input.nextInt(); for ( User s :list) { if(UserId == s.getUserId()) { System.out.println("UserName : " + s.getUserName()); System.out.println("UserDob: "+ s.getDob()); System.out.println("UserIncome: " +s.getIncome()); } } } }

Post your Comment



Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Related Articles
DMCA.com