0
Java scanner
Teacher t = new Teacher(1001, "john" , 28); Teacher t2 = new Teacher(1002, "rose", 26); Instead of this statement...how to accept these values using the scanner (need to accept values from user and pass it into an object)
2 Respuestas
+ 2
Scanner scan = new Scanner(System.in);
Teacher t = new Teacher(scan.nextInt(), scan.next() , scan.nextInt());
Teacher t2 = new Teacher(scan.nextInt(), scan.next() , scan.nextInt());
now input can be accepted as follows in the input box:
1001 john 28
1002 rose 26
0
Even better if you prompt users using Jake 's code.
System.out.println("teacher name: ");
Etc