.


:




:

































 

 

 

 


. . , , , .. ; , .. ; , .. .

, . . :

_ ( ) {

:

}

, , void - , . - -, . , .

Car, . Properties () rwheel ( ), typeBody ( ), engine ( ); . s (return s). void, .. , " "+this.rwheel.

 

public class Properties {

int rwheel;

String typeBody;

double engine;

//

public Properties (int rwheel, String typeBody, double engine) {

this.rwheel=rwheel;

this.typeBody=typeBody;

this.engine=engine;

}

//

String outDesk(){

String s="";

s=" : - "+this.typeBody+", - "+this.engine;

 

return s;

}

//

void outWeel(){

String s;

s= " "+this.rwheel;

System.out.println(s);

}

 

ford .

 

public static void main( String[] args) {

Properties ford=new Properties(17, "", 2.0);

//

System.out.println(ford.outDesk());

//

ford.outWeel();

}

 

. - , . Properties . String name;

 

public void setName (String s){

name=s;

s="";

}

 

 

public class Properties {

int rwheel;

String typeBody;

String name;

double engine;

 

public void setName(String s){

name=s;

s="";

}

 

public Properties(int rwheel, String typeBody, double engine) {

this.rwheel=rwheel;

this.typeBody=typeBody;

this.engine=engine;

}

public Properties(String name){

this.name=name;

}

 

/**

*

* @return

*/

public String outDesk(){

String s="";

s=" "+name+" : - "+this.typeBody+", - "+this.engine;

return s;

}

void outWee l(){

String s;

s= " "+name+" "+this.rwheel;

System.out.println(s);

}

 

:

 

public static void main (String[] args) {

String s="ford";

Properties ford=new Properties(17, "", 2.0);

// name

ford.setName(s);

System.out.println(ford.outDesk());

ford.outWeel();

}

 

, , . ( ).

( ). .. ( toString). .

Wheels ():

 

public class Wheels {

String manufact;

int size;

String typeDisk;

String typeWheel;

 

//

public Wheels(){};

public Wheels (String manufact, int size, String typeDisk, String typeWheel){

this.manufact=manufact;

this.size=size;

this.typeDisk=typeDisk;

this.typeWheel=typeWheel;

}

//

public String setName(String s) {

String name;

name=" "+s;

return name;

}

 

:

public class CarProp extends Wheels {

String name;

String typeBody;

double engine;

 

//

public CarProp(){};

public CarProp (String name, String typeBody,double engine){

this.name=name;

this.typeBody=typeBody;

this.engine=engine;

}

//

public String setName(String s){

s=" "+s;

return s;

}

 

:

public static void main (String[] args) {

Wheels w=new Wheels("Goodyear", 17, "", "");

CarProp c=new CarProp("ford", "", 2.0);

System.out.println(w.setName(w.manufact));

System.out.println(c.setName(c.name));

}

 

final, . , , . . abstract.

 



<== | ==>
ә ғ қ ғ | .
:


: 2017-02-11; !; : 217 |


:

:

, - , ; , - .
==> ...

1412 - | 1438 -


© 2015-2024 lektsii.org - -

: 0.023 .