Share on Google+Share on Google+

fnejedly
new String(text)
3 Answer(s)      8 years ago
Posted in : Java Beginners

Ads

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
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
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
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
JavaScript reverse text string
JavaScript reverse text string...; In this section, we are going to reverse the text string using JavaScript... string to the variable text. When you load the following code on the browser, you
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
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
new
new  hi the difference between string sname = good morning string sname =new("good morning
new
new    hi i am jane pls explain the difference between string greeting = good morning string greeting = new string ("good morning
new
new   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ <[email protected] contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html
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... main(String[] args) throws Exception { File f = new File("C:/file.txt
new
new    hi i am jane pls explain the difference between heap memory and stack memory
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
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
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
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
ExtractWords { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("Enter String... { public static void main(String[] args) { Scanner input=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
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
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... String addSpaceToRight(String s, int n) { return String.format("%1$-" + n + "s", s); } public static String addSpaceToLeft(String s, int n) { return
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  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  How to Convert sunnapu gopal to Sunnapu Gopal in java using String
String
String  write a program using string it should replace 'c'char to integer number as 1 in whole source
Tutorials   
Java Spring Hibernate Struts Training What does core Java include? java What are some way to learn Java quickly? Is it required to learn Java before learning Java Script? Is it necessary to learn java script before learning PHP? Are HTML5 and Java Script boosts Java career? Is Java object oriented? Fingerprint application with Java Uninstall Oracle Virtual Box JSON to HashMap Free Java online Training I want example of Control Statement in Java ANSI Color Codes with Python Create a Program that Calculates Input What is difference between JDK,JRE and JVM? How to see ubuntu version on server? How to get Page Source in Selenium (WebDriver) using Java? The path to the driver executable must be set by the webdriver.gecko.driver system property parse data from a link in java Java Program Qns using BlueJ How to fix HAX Kernel Module Is Not Installed error? Installing Audacity Looking for code Logic to check track changes & Coments in MSWord, MSWordx, MSExcel, MSExcelx is ON/OFF Installing JDK on Mac SAX Parser exception ERROR 601 (42P00): Syntax error. Encountered Thread java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory How to install Ubuntu 16.04 LTS? HttpServletRequest cannot be resolved to a type in eclipse - Solved Unhandled event loop exception GC overhead limit exceeded Spring Data jpa with apache phoenix Caused by: java.lang.IllegalArgumentException: Not a host:port pair: PBUF o.a.h.h.z.RecoverableZooKeeper - Possibly transient ZooKeeper, quorum= com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager class not found com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager not found How to download and install Java 8 on Windows? How to uninstall JDK 7? How to install gtk-doc-tools package in Ubuntu? How to install Oracle JDK 8 on Ubuntu? ejabberd_ctl.beam not found - Solved How to convert date to UTC format in Java? How to install autoconf, automake and libtool in Ubuntu 15.10? How to convert current date to mm dd yyyy format in Java? How to convert current date to dd mm yyyy format in Java? How to stop window closing in "internalFrameClosing" event. How to find list of all index in Neo4j? neo4j-server.properties file location SASLError using PLAIN: not-authorized how to convert war file into .exe file using java code

Ads

 
Advertisement null

Ads