fork(1) download
  1. // Ideone_Language_Id:55
  2. public class Car {
  3. public void toString() {
  4. print "I am a Car!"
  5. }
  6. }
  7. public class Ferrari extends Car {
  8. public void toString() {
  9. print "I am a Ferrari!"
  10. }
  11. }
  12. public class Indica extends Car {
  13. public void toString() {
  14. print "I am a Indica!"
  15. }
  16. }
  17. main(){
  18. Ferrari f= new Ferrari();
  19. Car c(f);
  20. Car* c2 = &f;
  21. c2->toString();
  22. c.toString();
  23. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:4: error: not a statement
		print "I am a Car!"
		^
Main.java:4: error: ';' expected
		print "I am a Car!"
		     ^
Main.java:9: error: not a statement
		print "I am a Ferrari!"
		^
Main.java:9: error: ';' expected
		print "I am a Ferrari!"
		     ^
Main.java:14: error: not a statement
		print "I am a Indica!"
		^
Main.java:14: error: ';' expected
		print "I am a Indica!"
		     ^
Main.java:17: error: class, interface, or enum expected
main(){
^
Main.java:19: error: class, interface, or enum expected
	Car c(f);
	^
Main.java:20: error: class, interface, or enum expected
	Car* c2 = &f;
	^
Main.java:21: error: class, interface, or enum expected
	c2->toString();
	^
Main.java:22: error: class, interface, or enum expected
	c.toString();
	^
Main.java:23: error: class, interface, or enum expected
}
^
12 errors
stdout

Standard output is empty