How you can create an object of a class in java?

Java

1 answer

Answer

1152502

2026-05-15 17:26

+ Follow

for creating objects use the new operator along with a call to the constructor. for ex Triangle t = new Triangle(); In this statement the new operator creates a triangle object and the constructor is called which initializes the object and then new returns a reference of the object which is stored in the reference var "t" of type Triangle.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.