current position:Home>What's wrong with the scanner usage?

What's wrong with the scanner usage?

2022-02-03 01:40:18 CSDN Q & A





Shape Circle =new Circle(2,3) This can succeed , But I want to use Scanner Enter the program you want to enter . This is not Scanner What does the definition method mean ? What's wrong with me ? How to change ?

Refer to the answer 1:

It just blocks . How did you call

Refer to the answer 2:

Refer to the answer 3:

getDirm The method is Shape Methods defined in the interface , Scanner This method does not exist in the class , So the compilation failed .

Refer to the answer 4:

Refer to the answer 5:
Scanner input = new Scanner(;        int a = input.nextInt();        int b = input.nextInt();        Shape shape =new Circle(a,b);        System.out.println(shape.getArea());        System.out.println(shape.getDirm());

Refer to the answer 6:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.

Random recommended