how is the ''new'' operator used in java?
Answers
Answered by
3
when you construct a class and you want to access it in main class then you have to make an object for it. And for making object you have to use new keyword.
for e.g.
Suppose you make a class test
class test{ }
now you want to access the class so in main method you will write
test a = new test();
and by this you can access the class in main method.
I hope my answer will help you
for e.g.
Suppose you make a class test
class test{ }
now you want to access the class so in main method you will write
test a = new test();
and by this you can access the class in main method.
I hope my answer will help you
Similar questions