The Artima Developer Community
Sponsored Link

Java Buzz Forum
Constructor help

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
News Manager

Posts: 47623
Nickname: newsman
Registered: Apr, 2003

News Manager is the force behind the news at Artima.com.
Constructor help Posted: Dec 12, 2013 7:22 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by News Manager.
Original Post: Constructor help
Feed Title: JavaWorld
Feed URL: http://www.javaworld.com/index.rss
Feed Description: JavaWorld.com: Fueling Innovation
Latest Java Buzz Posts
Latest Java Buzz Posts by News Manager
Latest Posts From JavaWorld

Advertisement

Q: If, when defining a class, we don’t define its constructor, the compiler implicitly assigns one. However, if we do define a constructor, the compiler interprets this as function overriding and does not flash an error. But if this is the case, why do I receive a compiler error in example 3 below?

Example 1:

class x
{
   int x,y;
   public void x( )  // The compiler considers this method overriding.
   {
       
   }
}
 
public static void main(String arg[])
{
   x x1=new x()   // No error.
}

To read this article in full or to leave a comment, please click here

Read: Constructor help

Topic: Run, JUnit! Run!!! Previous Topic   Next Topic Topic: New webinar – Feature development lifecycle with Git

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use