private String firstName=""; private String lastName=""; Public Person( String first, String last ) { // no need of void here firstName = first; lastName = last; } // end Person constructor Public string getFirstName() {// return data type was missing return firstName; } // end method getFirstName Public string getLastName() { return lastName ; } // end method getLastName } // end class Person public class JavaApplication3 { public static void main(String[] args) { Person test = new Person( "John", "Smith"); //object name must be different System.out.printf( "Happy Birthday to %s %s \n", test.getFirstName(), test.getLastName() ); // add %s for second string value // call the function with object and dot operator } }