
when i tried to run the below mentioned programmed it gives a error states - could not find main class programm will exit.
class Car { String name: String Color: int num: } public void accept(){ name = "BMW"; Color = "Block"; num = 1234; } public void disp(){ System.out.println("Name of the Car is: " + name); System.out.println("Color of the Car is: " + Color); System.out.println("Number of the Car is: " + num); } public static void main (String ars[]){ Car c = new Car(); c.accept(); c.disp(); }

Hello Friend,
Try this:
class Car { String name=""; String Color=""; int num=0;
public void accept(){
name = "BMW";
Color = "Block";
num = 1234;
}
public void disp(){
System.out.println("Name of the Car is: " + name);
System.out.println("Color of the Car is: " + Color);
System.out.println("Number of the Car is: " + num);
}
public static void main (String ars[]){
Car c = new Car();
c.accept();
c.disp();
}
}
Thanks

Hi Friend,
Try this:
class Car {
String name="";
String Color="";
int num=0;
public void accept(){
name = "BMW";
Color = "Block";
num = 1234;
}
public void disp(){
System.out.println("Name of the Car is: " + name);
System.out.println("Color of the Car is: " + Color);
System.out.println("Number of the Car is: " + num);
}
public static void main (String ars[]){
Car c = new Car();
c.accept();
c.disp();
}
}
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.