Question: Question 2 3 pts The following code is causing an exception during the runtime. class Mystery { public static void main ( String [ ]

Question 2
3 pts
The following code is causing an exception during the runtime.
class Mystery
{
public static void main(String[] args)
{
Object b1= new Scanner(
System.in);
Object b2= new Random();
doSomething (b1);
doSomething(b2);
}
public static void doSomething(Object o)
{
Scanner Scanner)o;
System.out.print("Enter your name: ");
String name =s.n extLine();
System.out.printIn(name.length());
}
}
which one of the following is the correct answer to fix the
 Question 2 3 pts The following code is causing an exception

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!