Issue
I just started using the Eclipse IDE and for a first test I created a file and entered the following:
class Vehicle {
public Vehicle(String s) {
System.out.println("X");
}
// public Vehicle() { }
}
public class Car extends Vehicle {
public Car(String s) {
System.out.println("Y");
}
public static void main(String [] args) {
new Car("Z");
}
}
But I immediately get errors saying println is not correctly spelled. Can someone tell me if there's something I am missing?
Solution
I think you have created an txt
file instead of a JAVA
file .
Because of this it is not able to recognize keywords related to java, thereby giving error that the word is not correctly spelled.
If you will change println
to print
,it will stop giving error .As Print is a proper word in English.
But here you need to change extension of file from .txt
to .java
Answered By - vikiiii