This week's book giveaway is in the Python forum.
We're giving away four copies of Python Continuous Integration and Delivery and have Moritz Lenz on-line!
See this thread for details.
Win a copy of Python Continuous Integration and Delivery this week in the Python forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Vargs in place of String array as argument to main() method please explain output  RSS feed

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1)public class ProgramArgument {

2) public ProgramArgument() { System.out.println(this); }

3) public static void main(String...args) {

4) new ProgramArgument();

5) System.out.println(args);
6) }
7) }
/* I obtain output
ProgramArgument@3e25a5
[Ljava.lang.String;@19821f

when i make comment the 4th statement I obtain output
[Ljava.lang.String;@3e25a5

Can anyone explain why this output and what's the reason of this output.....
Thanks */

 
Sheriff
Posts: 21642
101
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Ljava.lang.String;@3e25a5

The first [ always means it's an array. Next comes the type; I for int, B for byte, Z for boolean and L<class name>; for classes. So in this case, the [Ljava.lang.String; indicates it's a String array.
The part after the @ is the hexidecimal representation of the hash code.
 
Marshal
Posts: 63412
205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

As well as what Rob told you, have a look at the Object class and its un-overridden toString() method.
 
Nishant Arora
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks dear
 
We cannot change unless we survive, but we will not survive unless we change. Evolving tiny ad:
ScroogeXHTML 8.2 - easy to use RTF to HTML converter library
https://coderanch.com/t/707504/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!