all of u know java...?if u know pls tell me about Strings.

India
January 27, 2009 2:23am CST
I know the java is a platform independent software.I have more confusion on Strings.on some conditions and some places it acts as a string and some places as Object how....!
1 person likes this
3 responses
@ruperto (1552)
• Philippines
10 Apr 09
it seems the resulting code would be easily readable when object of class String is used instead of string (as a variable type). I would admit that writing a short code to process strings in a simple way is best written in a simple way i.e. use string variables. Is seems however, when the task of the code becomes more complicated, we need all the help we can get to understand, with least mental strain, how the code works and make the necessary improvements rapidly. Perhaps an interesting example is Unicode - using two bytes per character (may be very different from the standard character sets we use). By letting class String take care of the details, we can create code that can handle both one and two-byte chracters ... just a thought. Cheers.
• India
26 Feb 09
String is nothing but collection of characters in the just like arry. in c/c++ languages,a string represent a arry of characters
@dawon007 (184)
• India
27 Jan 09
A group of letters or words will only act as a string only if it is surrounded by the double quotes or if they are given as the value for string arrays or any other such data types. But an object is a name given to the instance of a class. It is defined by placing it after the class name. In other words the class which you have created is user defined data type and the object the variable of that data type. Although both the object name and the string can be same in a program, there is no problem as long as they are initialized with different datatypes, as is the case with other variables. Eg:- Object initialization school Montfort Here school is the name of the class that is already defined and existing, while Montfort is the object (or variable) of that class. String initialization. String a = "dawon007"; here a is the name of the variable and dawon007 is the value that it holds. If you have any more doubts, feel free to ask.