Question: java 1- Given the following code snippet: ArrayList shapes = new ArrayList (); Scanner scan1=new Scanner(new File(D:AAUJAAA adiusInfo.txt)); //This statement is equivalent to Scanner scan1=new

java

1-

Given the following code snippet:

ArrayList shapes = new ArrayList<>();

Scanner scan1=new Scanner(new File("D:\\AAUJ\\AAA\ adiusInfo.txt")); //This statement is equivalent to Scanner scan1=new Scanner(new FileInputStream("D:\\AAUJ\\AAA\ adiusInfo.txt"));

while(scan.hasNext())

{

double radius;

scan.next();

radius=Double.parseDouble(scan.next());

shapes.add(new Circle(radius));

}

Select one:

a. The compiler will report an error

b. The compiler will report an error if Circle class does not extend Shape class

c. None of these

d. The compiler will report an error if Shape class does not extend Circle class

2-

The following method signature is valid in Java:

public Circle getCircleWithMaxArea(ArrayList c1, Circle ...c2)

Select one: True False

3-

Given the following code segment:

1. try {

2. //do something here

3. }

4. catch (IOException ex)

5. {

6. System. out.println( "I/O error") ;

7. }

8. catch (NumberFormatException ex)

9. {

10. System. out.println ( "Bad input") ;

11. }

12. System.out. printIn ("Done" ) ;

What will be printed if a NumberFormatException occurs in the try block?

Select one:

a. Bad input, Done

b. Done, I/O error

c. I/O error

d. Done.

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!