Mark As Completed Discussion

Instantiating objects

After running the above code, you will not find any output. Rather, you may get an error message saying "No Main Class Found". This occurs since all Java programs must have a main method where the program will start. The Keyboard class, however, should not have a main method, so we will create another class named Main inside a new file called Main.java and run it.

We somehow need to use that class (blueprint) file to create different kinds of keyboards. The process of creating a real object from a class is called object instantiation. In Java, we can instantiate an object using the new keyword.

Instantiating Objects

JAVA
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment