Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
    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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

urgent doubt-giving SCJP within next 13 hours

 
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Report post to moderator

Why this code does not compile?
class MyClass {
public int x;
public MyClass(int x) {
this.x = x;
}
class YourClass extends MyClass {
public int y;
public void main() {
System.out.println(x + " & " + y);
}
}
}
i thought it would compile but give runtime error since proper main is
not provided.
I understand that superclass does not have default constructor now.
But why is it called ?
We are not creating any object of YourClass in YourClass!!
Can someone give me the logic behind this??
thanx in advance
 
Ranch Hand
Posts: 464
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hey leena
The problem is you dont have a default constructor in your parent class... Implement a default constructor in your parent
or write a constructor in your child class calling super(int)as the first line inside your constructor. That will fix it
Ragu
 
Ranch Hand
Posts: 1072
  • Mark post as helpful
  • send pies
  • Report post to moderator
Good luck Leena !
I wish you all the best !
 
Ranch Hand
Posts: 1246
1
  • Mark post as helpful
  • send pies
  • Report post to moderator
Good luck!! By now.. i think you passed already
 
leena rane
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Report post to moderator
so sweet of you Ersin,Fei ng
I need those wishes
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Report post to moderator
All the best Leena. Here u gonna become a scjp soon.
sandy
 
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Report post to moderator
Leena
All the best you've put the effort in learning this stuff and asking / answering questions just be cool and get plenty of rest before hand
rgds Jim
 
leena rane
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Report post to moderator
Thanx Sandeep and Jim,
I have just returned from giving exam(this is first thread i am visiting as an SCJP)
new SCJP
leena
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
Good job Leena, you really deserved it

------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Report post to moderator
Good Job Leena! This does not come as a surprise. BTW...Iam waiting for your comments on the exam as I am taking it on Nov 5<super>th</super>.
Shyam
 
Jim Petersen
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Report post to moderator
Well done Leena - Your hard work has paid off
Look forward to reding about your experiences in the Results section
All the best - Jim
 
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
  • Report post to moderator
Congratss Leena ! , da SCJP !
had no doubt in mind dat u ll make it
good job
ll be looking 4 ur post in results-forum
Best wishes for ur future
------------------
Gagan (/^_^\) SCJP2
Die-hard JavaMonk -- little Java a day , keeps u going .
 
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
Congrats Leena,
Awaiting tips from you.
- Manish
 
Fei Ng
Ranch Hand
Posts: 1246
1
  • Mark post as helpful
  • send pies
  • Report post to moderator
Congratss !!!
Happy to hear that!! Good work!!
 
ersin eser
Ranch Hand
Posts: 1072
  • Mark post as helpful
  • send pies
  • Report post to moderator
nice job !
 
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
  • Report post to moderator
Congratulations Leena... Don't forget to share your experience with us..

Originally posted by leena rane:
Thanx Sandeep and Jim,
I have just returned from giving exam(this is first thread i am visiting as an SCJP)
new SCJP
leena


 
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Report post to moderator
Congratulations Leena
--Farooq
 
sandeep bhatnagar
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Report post to moderator
CONGRATS!!
U GOT REALLY A GOOD SCORE
sandy
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
Leena got her programmer certification and is discussing some points in the Programmer Certification Result Forum.
Everybody can congratulate her there, she really deserves it
------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform

[This message has been edited by Valentin Crettaz (edited October 29, 2001).]
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic