Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
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:
Beginning Java
what if i print an object without specifing its felds to be printed?????
Deepakk Verma
Ranch Hand
Posts: 31
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
if i write this code
public class Box { int a,b; Box(int i,int j) { a = i; b = j; } } public class BoxDemo { public static void main(String args[]) { Box mybox = new Box(15,20); System.out.println("mybox"+mybox); } }
it is giving me result as
myboxBox@19821f
can you tell me why?
(i know this code is of no use but i was curious to know why is it generating this output)
please explain....
Rahul P Kumar
Ranch Hand
Posts: 188
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Follow this
link
. If you want meaningful print, you need to override toString() of Object (object with capital O) class.
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
BufferString
Object reference and object and garbage collection
basic concepts on Serialization
Can I pass character array to new method?
Return type concept problem
More...