0

I am new to java programming

I run the following code

public class tuna {
    private String girlName;
    public void setName(String name){
        girlName = name;
    }

    public String getName(){
        return girlName;
    }

    public void saying(){
        String name = getName();
        System.out.printf("Your first gf was %s",name);
    }
}

It shows the following error:

Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
    The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, String)
Sugumar Venkatesan
  • 4,019
  • 8
  • 46
  • 77

0 Answers0