Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: How many rules are there in Java Constructor Overloading?

  1. #1
    Junior Member
    Join Date
    Sep 2021
    Location
    Pune
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Exclamation How many rules are there in Java Constructor Overloading?

    Hi All, I just started learning Java and was reading the Constructor Overloading article. However, I am a bit confused about how many rules are there, three rules I have listed below ->

    - The constructor's name should match the name of the class.
    - A constructor cannot have a return type.
    - A Java constructor cannot use the keywords abstract, static, final, and synchronized.

    Are there any other rules that I am missing?


    Article that i was reading: https://www.scaler.com/topics/constr...ading-in-java/

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: How many rules are there in Java Constructor Overloading?

    Look at the java specification docs: https://docs.oracle.com/javase/specs...tml/index.html
    If you don't understand my answer, don't ignore it, ask a question.

  3. The Following User Says Thank You to Norm For This Useful Post:

    supernerd007 (January 28th, 2022)

Similar Threads

  1. Replies: 0
    Last Post: September 24th, 2018, 06:24 AM
  2. Testing Constructor Overloading using Eclipse
    By michael.duffy31 in forum Java IDEs
    Replies: 8
    Last Post: September 2nd, 2013, 01:01 AM
  3. constructor overloading
    By jamesjack in forum What's Wrong With My Code?
    Replies: 1
    Last Post: August 13th, 2013, 12:12 AM
  4. New to Java : Need help with my integers rules
    By MartinRR in forum What's Wrong With My Code?
    Replies: 3
    Last Post: September 29th, 2011, 01:14 PM