0

Code doesn't give any output

My code compiles and runs without any errors, but it doesn't give any output. I am expecting output from class BMW. Maybe someone could help me to identify what is missing? Code: package cartester; public class CarTester { public static void main(String[] args){ abstract class Car{ abstract void Manufacturer(); abstract void Model(); abstract void Year(); void MyCar(){ System.out.println("My car:"); } } class BMW extends Car{ @Override void Manufacturer(){ System.out.println("Manufacturer: BMW"); } @Override void Model(){ System.out.println("Model: 530d"); } @Override void Year(){ System.out.println("Year: 2002"); } } class Audi extends Car{ @Override void Manufacturer(){ System.out.println("Manufacturer: Audi"); } @Override void Model(){ System.out.println("Model: A6"); } @Override void Year(){ System.out.println("Year: 1998"); } } class TestBMW{ public void main(String[] args){ Car MyBMW = new BMW(); MyBMW.Manufacturer(); MyBMW.Model(); MyBMW.Year(); } } } }

17th Sep 2019, 8:18 AM
Stasys Domarkas
Stasys Domarkas - avatar
5 odpowiedzi
17th Sep 2019, 8:30 AM
Sumit Programmer😎😎
Sumit Programmer😎😎 - avatar
+ 14
remove package statement in the top of your code. becz solo learn does not support packages.
17th Sep 2019, 8:21 AM
Sumit Programmer😎😎
Sumit Programmer😎😎 - avatar
+ 1
Try write it all out of the cartester main
17th Sep 2019, 8:28 AM
KfirWe
KfirWe - avatar
+ 1
Thank you!
17th Sep 2019, 9:57 AM
Stasys Domarkas
Stasys Domarkas - avatar
0
I forgot to mention - I am trying to run my code in NetBeans IDE 8.2
17th Sep 2019, 8:22 AM
Stasys Domarkas
Stasys Domarkas - avatar