new String(text)

new String(text)

View Answers

September 10, 2008 at 11:42 AM

Hello Friend

this.text = text : In this case text will go pool area and this.text refer it.

this.text = new String(text):
In this Case Java will create a new String object
in normal (non-pool) memory, and this.text will refer to it. In addition, the literal text will be placed in the pool.

Refer SCJP Book Chapter6

Thanks

September 10, 2008 at 12:28 PM

Thank you very much.
One more thing please, how can I get a variable pointer to see where it points to?
Thanks,
T.

September 10, 2008 at 5:45 PM

Visit for more information.


http://www.roseindia.net/java/


Thanks.









Related Tutorials/Questions & Answers:
new String(text) - Java Beginners
new String(text)  Please, what is the difference between this.text = text; and this.text = new String(text); in the example: public... = new String(text); } }  Hello Friend this.text = text
c++ new, delete, string class
c++ new, delete, string class  Write one program containing all... contained in string1: Exercise 1 Good morning Create a new string named string2... Exercise 5 69 Create a new string named string6 containing the contents from
Advertisements
JavaScript reverse text string
JavaScript reverse text string...; In this section, we are going to reverse the text string using JavaScript... entering the text, you will get the reverse string in the same text box. Here
Write Text To File In New Line.
Write Text To File In New Line. In this tutorial you will learn how to write text into file in a new line. When you are writing in a file you may be required to finish the line and want to write the other text in a new line
searching a text string in file - Java Beginners
searching a text string in file  code to match a string in a file that is already mentioned in java code.if the string matches any part of a string that whole string is printed
ModuleNotFoundError: No module named 'trw_text_string'
ModuleNotFoundError: No module named 'trw_text_string'  Hi, My... named 'trw_text_string' How to remove the ModuleNotFoundError: No module named 'trw_text_string' error? Thanks   Hi, In your python
Adding text in to text area of jframe at new line with different background colour
Adding text in to text area of jframe at new line with different background colour  Hi, I am reading text from text file and i want to write... to write that text every time at new line in text area with different background
ModuleNotFoundError: No module named 'text-new-wargame'
ModuleNotFoundError: No module named 'text-new-wargame'  Hi, My... named 'text-new-wargame' How to remove the ModuleNotFoundError: No module named 'text-new-wargame' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'text-new-wargame-git'
ModuleNotFoundError: No module named 'text-new-wargame-git'  Hi...: No module named 'text-new-wargame-git' How to remove the ModuleNotFoundError: No module named 'text-new-wargame-git' error? Thanks   Hi
How to write file text In New Line
How to write file text In New Line  Hi friends, How to write file text in new line in Java program. How to write the syntax for this with example. thanks   Hi, For write a new text new line we need bufferedwriter
ModuleNotFoundError: No module named 'text-new-wargame-git-twine'
ModuleNotFoundError: No module named 'text-new-wargame-git-twine'  Hi...: No module named 'text-new-wargame-git-twine' How to remove the ModuleNotFoundError: No module named 'text-new-wargame-git-twine' error? Thanks
Replacing a Text Node with a New CDATA Section Node
Replacing a Text Node with a New CDATA Section Node... to replace a Text node with new CDATASection Node in a DOM document. Methods which are used for replacement of the text node in the DOM Document are described
How to create a new text file that contains the file names of the copied files in a new directory? - Java Beginners
How to create a new text file that contains the file names of the copied files in a new directory?  Okay so my question is: How to create a new text file that contains the file names of the copied files in a new directory
Removing Line Termination Characters from a String
symbol where the new line character was present in the string or text... of with program code which reads the string or text of a text file which... the string as output in the console, you will understand where the new line
new
new  hi the difference between string sname = good morning string sname =new("good morning
Java file new line
Java file new line In this section, you will learn how to write the text in new line of text file. Description of code: The package java.io.* has provide... { public static void main(String[] args) throws Exception { File f = new File("C
new
new   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html
new
new    hi i am jane pls explain the difference between string greeting = good morning string greeting = new string ("good morning
I retrieve a String or other object type without creating a new object each time.
I retrieve a String or other object type without creating a new object each time.  How can I retrieve a String or other object type without creating a new object each time
string
string  String helloString = new String(helloArray); System.out.println(helloString); i am unable to understand this. could u plz explain
string
ArrangeStringAlphabetically { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("Enter string...string  a java program using string function to input any string
String
characters in string?   import java.util.*; class RemoveDuplicateCharatcersFromString { public static String removeDuplicates(String s) { StringBuilder build = new StringBuilder(); for (int i = 0; i
string
capitalizeFirstLetter( String str ) { final StringTokenizer st = new StringTokenizer( str... : "); BufferedReader br =new BufferedReader(new InputStreamReader(System.in)); String inputString = br.readLine(); FirstLetter letter=new FirstLetter(); String words
string
) { Scanner input=new Scanner(System.in); System.out.print("Enter String...) { Scanner input=new Scanner(System.in); System.out.print("Enter String: "); String str=input.nextLine(); StringTokenizer st=new
string
string   just i want to a program in a short form to the given string in buffered reader for example input string: Suresh Chandra Gupta output: S. C...; public class StringTest { public static void main(String [] args
new
new    hi i am jane pls explain the difference between heap memory and stack memory
string
and also displaying that contain word? Like I want to find "a" in the string... and a character. It then count the occurrence of that character in the string and display... String_Example { public static void main(String[] args
string
(String[] args) { String array[]=new String[5]; Scanner input=new Scanner(System.in); System.out.println("Enter List Elements...string  program for String reverse and replace in c,c++,java
STRING.....
STRING.....  plzz sent me d code for counting vowels in a string... gui programme
string
string   difference detween "public static void main (String[] args) " and "public static void main (String args[])" in java but it executes both... "String args[]" can mean a "string array called args which is an array
String
String  how to add spaces with string functions.?   Hi... { public static String addSpaceToRight(String s, int n) { return String.format("%1$-" + n + "s", s); } public static String addSpaceToLeft(String s, int n
String
String  write down the code of remove any character from a given string without using any string function   please give me the code of remove any given character from a given string without using function
string
string  write a program to accept the string and store the reverse stream into another array and print
string
string  java prgm to find total occurence of a given string pattern in a sentence
string
string  java prgm to find total occurence of a given string pattern in a sentence
String
String  write a program using string it should replace 'c'char to integer number as 1 in whole source
String
String  How to Convert sunnapu gopal to Sunnapu Gopal in java using String
String
String  how to print in between numbers if the question "String s = "1,2,3,4,5,6,8,-25"" out must be 1 2,3,4,5,6,7,8,9,10,upto25
string
string  a java program using string function that computes your initials from your full name and display them   Please visit the following links: http://www.roseindia.net/tutorial/java/core/printInitials.html
string
string  a java program using string function and access modifiers to automate the insurance company which will have to manage the information about policy holders Data Members: 1)Policy No 2)Name of policy holder 3)Address 4
Replacing all the text of String using expression
Replacing all the text of String using expression..._TO_REPLACE_1 String text = "kavaSun's regex library Kava is now kava"... to Replace certain part of the whole String using regular expression. For this we
Convert Text To PDF
the string. 6.Use doc.add(p) to add the text. 5. Close the document by using... BufferedReader(in);       System.out.println("Enter text:");         String text..."));         document.open();         document.add(new Paragraph(text
Splitting One Text Node into Three
Splitting One Text Node into Three       This Example describes a method to split a Text node into three new Node in a DOM document. Methods which are used for splitting
String replaceFirst() Method
String replaceFirst() Method       In this program you will learn how to replace words in a text. We are going to use replaceFirst() method of String class in Java
inserting text into text file using java application
inserting text into text file using java application  Hi, I want to insert a text or string into a text file using java application
text file
void main(String []args){ ArrayList<HardwareItems> list=new ArrayList<...text file  Hi can you help me I have to modify the program below so that all the data held in it is stored in an external text file.So there should
Input - Output String Functions
Input - Output String Functions      ... data from a user (text field, text area) since it is not secure to receive a string data and input them directly into your database. Some special characters
gradient text, text effect, text
to take a new file with black background as here.ADS_TO_REPLACE_1 Write Text... How to make a gradient text       We can make many different type of text by the help
new 2
new 2  <%@page import="java.util.ArrayList"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <...-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>
String Ques
str=new String("abc");   Hello Friend, Differences: 1)String str=new string("abc") creates two objects, one in heap memory and one in string...)String str = abc is a String literal where as String str = new String("abc

Ads