kutayatesoglu kutayatesoglu - 7 months ago 15
Java Question

How to update a class properly in Eclipse

When I update or add a constructor in a class, Eclipse doesnt update the class in other scrapbook which I imported the class before.

For example my class code is like this;

public class Car{
public Car(){

In an scrapbook I import this class an create a Car instance. But when I try to update my original class to this and try to create another Car instance;

public class Car(){
public Car(String brand, String year){
this.brand= brand;
this.year= year;

It gives me the error "The constructor Car(String, String) is undefined".

The error goes away after I close and re-open Eclipse one time. Can someone help me how to update a class properly.


In most cases the main cause is that you didn't save the Car.java file. Remember to press Ctrl+S every time you edited a file.