current position:Home>Programming with eclipse Java

Programming with eclipse Java

2022-02-02 20:51:58 CSDN Q & A

1、 Programmatically define a Car class ,

(1) Including tires (tire), The engine (engine) etc. public Member variables ;

(2) Including a public Type of showInfo() Member method , stay showInfo Method output car Information about all member variables of the class ;

(3) Create a Car Class , call showInfo() Method .

Define a Toyota class ,

(1) Inherited Car All inheritable properties and methods , Member variables tire The value is “ Hantai tire ”, Member variables engine The value is “ Naturally aspirated ”;

(2) There is one public A member variable of type logo, The value is “TOYOTA”;

(3) There is one public Member method of type speedUp(), Output “ The acceleration is very smooth ”;

(4) stay showInfo() Method output Toyota Information about all member variables of the class ;

(5) Create a Toyota Class , call showInfo() and speedUp() Method .

Define a Volkswagen class ,

(1) Inherited Car All inheritable properties and methods , Member variables tire The value is “ Michelin tyre ”, Member variables engine The value is “ turbo ”

(2) There is one public A member variable of type logo, The value is “VOLKSWAGEN”;

(3) There is one public Member method of type stop(), Output “ Short braking distance ”;

(4) stay showInfo() Method output Volkswagen Information about all member variables of the class ;

(5) Create a Volkswagen Class , call showInfo() and stop() Method .

Define a GOLF class ,

(1) Inherited Volkswagen All inheritable properties and methods ,

(2) There is one private A member variable of type controlSystem, The value is “PQ36”

(3) Override the stop() Method , Output “ Brakes are awesome ”;

(4) stay showInfo() Method output GOLF Information about all member variables of the class ;

(5) Create a GOLF Class , call showInfo() and stop() Method .




Refer to the answer 1:

Don't be lazy . come on.




Refer to the answer 2:



Refer to the answer 3:

It's better to do your homework by yourself




Refer to the answer 4:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202022051565365.html

Random recommended