You can have two String variables (note that String variables are object references) refer to the same String object like so:
String str1 = "Hello";
String str2 = str1;
Now the str1 and str2 are references for the same String object containing the word "Hello".
If you actually want a new String object with a copy of the contents of the original String, you use the String constructor that takes a String argument, like so:
String str3 = new String(str1);
Now str1 and str3 refer to SEPARATE String objects that happen to contain the same sequence of characters (the word "Hello").
Since Strings objects in Java are immutable, they can be shared without worrying about the contents used by one variable being upset by the use through another variable as might happen with char[] arrays in C or C++ so the first method is probably sufficient for most cases.
what is string
i dont no string for servlate
.... String line = "This is example program with spaces"; String[] tokens = line.split(" "); System.out.println(tokens.length-1); .......
what is if(!(str[i]==32))
[ string toupper $str ] or [ string tolower $str ]
what is string
Read the characters one at a time, and write an "if" for each of the cases. In each case, if the condition is fulfilled, increment the corresponding counter variable.
i dont no string for servlate
i am sam
This is an assignment not a question.
what is if(!(str[i]==32))
Use for loop declare string array str[] and string variable l= string length of string array j=l for i=0 to i=l/2 then temp=str[i] str[i]=str[j-1] str[j-1]=temp j=j-1 now print str array it will be reversed
.... String line = "This is example program with spaces"; String[] tokens = line.split(" "); System.out.println(tokens.length-1); .......
what is if(!(str[i]==32))
[ string toupper $str ] or [ string tolower $str ]
No.
int a,b; a=a+b; b=a-b; a=a-b; that's it simple