• 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

default String

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm have a few questions. Could somebody help me out?
is String a class?
will the default String field be empty string("") if the String field has not been initialized?

thanks

Sura
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sura,

Yeah String is a class........And about the other question why don't you try and write a small code and get it run....

String n;
String x = new String("");

Such codes will help you.....Any small doubts can be clarified by writing programs....Many of our peers have suggested this. This will help you to learn more definitely.

Still if you face problems then come up with post.....okay....Have good time with Strings....
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have read the String API?

String s; defines a reference to an instance of the String class.

Except for local variables the default value of object references is null.

The use of the constructor String() (with no arguments) will cause an empty string ("") to be created.
 
reply
    Bookmark Topic Watch Topic
  • New Topic