• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Class  RSS feed

 
Arathi Raj
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

Name four methods every Java class will have>
Is these answers correct
public String toString();
public Object clone();
public boolean equals();
public int hashCode();

I feel even we can mention wait(),finalize (). If wrong correct me.

Also I want to know what are marker's interface.?
Thanks
ARathi
 
Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
clone is not public.

What information are you after that the J2SE API Specification doesn't already provide?
 
Sathya Srinivasan
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Every class in Java extends java.lang.Object. As a result, any method that is in java.lang.Object will be present in any other class.

As Tony mentioned, familiarize yourself with the Java API. That's the best tool that a Java programmer can ever have.

Marker interfaces are interfaces that do not have any methods that need to be implemented by the imeplementing class. Ex. java.io.Serializable

As I mentioned earlier, interfaces are typically used to generalize the behavior of a bunch of related classes. Marker interfaces are a special kind of interfaces that they are typically used to say that 'these classes are tagged for a specific purpose'. In case of the Serializable, it means that the implementing classes can be persisted (converted to bytes and stored somewhere and restored back if needed).
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!