Java Help

hoc34

 What is wrong with this code:

 
public class NamePrinter {
 
public void printName() {
   System.out.println("My name is: " + myName);
}
 
public static void main( String[] args ) {
 
   String myName = "George Washington";
 
   NamePrinter namePrinter = new NamePrinter();
   namePrinter.printName();
   }
}
    • 11 years ago
    • 3
    Answer(3)

    Purchase the answer to view it

    NOT RATED
    • discussion_on_the_error_in_the_code.docx

    Purchase the answer to view it

    NOT RATED
    • untitled.docx

    Purchase the answer to view it

    NOT RATED
    • homewrok_5499711-2.png
    • javacode_changed_5499711-2.txt
    Bids(0)