Java Help

profilehoc34

 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

    blurred-text
    NOT RATED
    • attachment
      discussion_on_the_error_in_the_code.docx

    Purchase the answer to view it

    blurred-text
    NOT RATED
    • attachment
      untitled.docx

    Purchase the answer to view it

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