• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

what is the difference???

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all
consider the following code snippets
/*****code snippet1******/

/***end of code snippet1****/

/***code snippet2****/

/***end of code snippet2**/
the first snippet works fine it doesn't complain about the absence of explicit default constructor declaration
but the second code complains!!
please can anyone explain me the difference..
thank you
malathi
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Both fail for me with compile error: Missing default constructor!
Manfred.
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Malathi.
Have you compiled the code ? Because according to my understanding both code snippet should fail as mentioned by Manfred.


------------------
http://www.mantrotech.com
 
Ranch Hand
Posts: 404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi malathi,
I think u did a mistake in your question itself,
if in code snippet1 if you specify a return type such as void for method test[ in which case it wouldn't be a constructor anymore] then your thinking is right,
if you dont mean it then they both are same snippets.
Anil.
/***** http://www.anilbachi.8m.com scjp resources*****/////
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic