How to create an object of a class?
Answers
Answered by
1
Answer:
To create an object of Main , specify the class name, followed by the object name, and use the keyword new :
Example. Create an object called " myObj " and print the value of x: public class Main { int x = 5; public static void main(String[] args) { Main myObj = new Main(); System. ...
Explanation:
hope it's help full to you
Similar questions