Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
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
Ron McLeod
Paul Clapham
Tim Cooke
Devaka Cooray
Sheriffs:
Liutauras Vilda
paul wheaton
Rob Spoor
Saloon Keepers:
Tim Moores
Stephan van Hulst
Tim Holloway
Piet Souris
Mikalai Zaikin
Bartenders:
Carey Brown
Roland Mueller
Forum:
Programmer Certification (OCPJP)
Thangaraj S.
Thangaraj Selvamani
Ranch Hand
Posts: 61
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Can any one give be the explanation for the code above and y it prints the output as parent
class Parent {
String
message = "parent";
void say() {
System.out.println(message);
}
}
class Child extends Parent {
String message = "child";
}
public class ScjpTest3 {
public static void main(String[] args) {
new Child().say();
}
}
Ulf Dittmer
Rancher
Posts: 43081
77
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Welcome to JavaRanch.
The way JavaRanch works is not just to give out answers, but to help people understand what's going on. So: What is the output, and why do you think that is? Where is it different from what you thought it would be? Can you think why?
We also have a collection of tips on how to get the most out of the Saloon:
HowToAskQuestionsOnJavaRanch
, in particular
UseAMeaningfulSubjectLine
.
Thangaraj Selvamani
Ranch Hand
Posts: 61
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Sorry for the mistake... im new to this site...
here after i will give correct and reasonable title...
ya..i got the explanation for that code...
thanks for the links... will go through it...
thanks...
Jesper de Jong
Java Cowboy
Posts: 16084
88
I like...
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Double post
Jesper's Blog
-
Pluralsight Author Page
Don't destroy the earth! That's where I keep all my stuff! Including this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
doubt in overloading
Method Overlaoding questions/doubt
shadowing
an inheritance question
Help
More...