Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
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
Forum:
Java in General
Please explain output of mention source code
Kaustubh G Sharma
Ranch Hand
Posts: 1283
I like...
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
public abstract class MyClass {
public void
test
() {
System.out.println("Howdy");
}
public static void main(
String
[] args) {
MyClass m = new MyClass() {
};
m.test();
}
}
Output: Howdy
Please explain it. Thanks
No Kaustubh No Fun, Know Kaustubh Know Fun..
Campbell Ritchie
Marshal
Posts: 79153
377
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You are creating an anonymous class which is a subclass of that abstract class.
Campbell Ritchie
Marshal
Posts: 79153
377
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Java Language Specification link
about anonymous classes.
Tyson Lindner
Ranch Hand
Posts: 211
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
So many tricky
java
problems. I didn't catch the brackets after "new MyClass()" at first.
I like you because you always keep good, crunchy cereal in your pantry. This tiny ad agrees:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
equals and this
equals again
Strange recursive method call! ???
Variable Initialization
This is from Tip Smarts Sample Paper
More...