Multiple choice in java Given the following code snippet: ArrayList shapes = new ArrayList<>(); Scanner scan1=new Scanner(new File("D:\\AAUJ\\AAA\\radiusInfo.txt")); //This statement is equivalent to Scanner scan1=new Scanner(new FileInputStream("D:\\AAUJ\\AAA\\radiusInfo.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 if Shape class does not extend Circle class b. The compiler will report an error
Multiple choice in java
Given the following code snippet:
ArrayList<Shape> shapes = new ArrayList<>();
Scanner scan1=new Scanner(new File("D:\\AAUJ\\AAA\\radiusInfo.txt")); //This statement is equivalent to Scanner scan1=new Scanner(new FileInputStream("D:\\AAUJ\\AAA\\radiusInfo.txt"));
while(scan.hasNext())
{
double radius;
scan.next();
radius=Double.parseDouble(scan.next());
shapes.add(new Circle(radius));
}
The compiler will report an error if Shape class does not extend Circle class
The compiler will report an error
The compiler will report an error if Circle class does not extend Shape class
None of these
Trending now
This is a popular solution!
Step by step
Solved in 2 steps