• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Return type of a method if it returns object of any class

 
Aditya Anup
Greenhorn
Posts: 2
Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there!

I have just started preparation for OCAJP

I have little confusion with the return type of a method if it returns object of any class or interface.please explain with example.

thanks and regards

Aditya Anup
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Aditya Anup,

First of all, a warm welcome to CodeRanch!

Aditya Anup wrote:I have little confusion with the return type of a method if it returns object of any class or interface.please explain with example.

Can you give a little more detail what's confusing you exactly?

A method can return:
  • nothing
  • a primitive data type
  • any type (a class, an interface, an enum)


  • Hope it helps!
    Kind regards,
    Roel
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic