public class Car{
String name, color, number;
int speed;
int years;
Car(){};
Car(String name, int year){this.name=name; years=years;}
public void setName(String name){this name=name;}
public String getName(){return this.name;}
public void Print(){
System.out.println("Mashina nomi"+"name"+"rangi"+"color";)}}
public void set(String name, String color, String number,int speed,int years,{name=name;color=color;number=number;speed=speed;years=years)
{
package com.company;
public class Main {
public static void main(String[] args) {
// write your code here
Car C1=new Car();
Car C2=new Car("Centra", 2016);
System.out.println(C1.getName());
System.out.println(C2.getName()+" "+C2.getName());
C1.setName("captiva");
System.out.println(C1.getName());
C1.set("captiva","black","01A102BC",260,2019);
C2.set(C2.getName();)
C1.Print();
C2.Print();}}
Do'stlaringiz bilan baham: |