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
  • 3,782
  • 7
  • 39
  • 71

0 Answers0