Life is but a BREATH
Randy Tong wrote:As stated from here
Returns a formatted string using the specified format string and arguments.
Hari Nagarjuna wrote:
What if System.out.print() is used?
Life is but a BREATH
Is there any difference between them?
Life is but a BREATH
Randy Tong wrote:
Is there any difference between them?
Yes, they are totally different.
Life is but a BREATH
Hari Nagarjuna wrote:
Randy Tong wrote:
Is there any difference between them?
Yes, they are totally different.
Excuse me I have just started learning programming a month ago.
I know string datatype is an array of characters.
But i am no sure about methods of string and their usage,Can you please refer me to a link where I can learn about methods of string and their usage?
Jasper Abapo wrote:
Hari Nagarjuna wrote:
Randy Tong wrote:
Is there any difference between them?
Yes, they are totally different.
Excuse me I have just started learning programming a month ago.
I know string datatype is an array of characters.
But i am no sure about methods of string and their usage,Can you please refer me to a link where I can learn about methods of string and their usage?
I'm still new to programming and I've been helped by Sir Randy Tong each time I encounter problems. I look forward in learning with you in this ranch!
Life is but a BREATH
Afraid that is incorrect; it even says so in the Java® Language Specification (=JLS). I hope nobody has told you the two are the same.Hari Nagarjuna wrote:. . . I know string datatype is an array of characters. . . .
Campbell Ritchie wrote:
Afraid that is incorrect; it even says so in the Java® Language Specification (=JLS). I hope nobody has told you the two are the same.Hari Nagarjuna wrote:. . . I know string datatype is an array of characters. . . .
. . . and welcome to the Ranch
Hari Nagarjuna wrote:but I have seen that string is basically an object that represents sequence of char values...
Paul Clapham wrote:
Hari Nagarjuna wrote:but I have seen that string is basically an object that represents sequence of char values...
Sure, that's (almost*) true. But that's a long way from actually being an array of characters.
* I say "almost" true because a String actually represents a sequence of Unicode characters. Java was changed in (I believe) version 1.5, which was released in 2004, so that String objects could represent Unicode characters which aren't in the Unicode BMP. Previously they could only represent Unicode characters in the range up to U+FFFF, which correspond to Java chars.
Those of us who have been in this trade a long time know there are lots of bad tutorials. That tutorial gets off to a good start saying,Hari Nagarjuna wrote:. . . https://www.javatpoint.com/java-string . . .
which you have quoted and, except for writing string, that is “basically” correct (so you were correct about the same point ). It even says that String implements CharSequence, which I recommend you read about if you have difficulty getting to sleepIn Java, string is basically an object that represents sequence of char values.
Unfortunately, that tutorial then goes completely wrong in its second sentence. The following is totally wrong:-The CharSequence documentation wrote:A CharSequence is a readable sequence of char values.
Your information about Unicode is, I am afraid, very much out of date.That tutorial wrote:An array of characters works same as Java string. For example:
char[] ch={'j','a','v','a','t','p','o','i','n','t'};
String s=new String(ch);
is same as:
String s="javatpoint";
Consider Paul's rocket mass heater. |