answersLogoWhite

0

public class Test {

public static void main(String[] args){

String str = new String("Rocky");

String str1 = "Rocky";

StringBuffer sb = new StringBuffer();

sb.append("Rocky");

String str2 = new String(sb);

}

}

Above are three commonly used ways of creating Strings. Apart from you you can also pass byte arrays and character arrays as arguments to the String constructor

User Avatar

Wiki User

16y ago

What else can I help you with?

Continue Learning about Engineering
Related Questions

What do you mean by operators and operands?

operands are the objects or variable that we create in our program. operators fuse with the operands to build a mathematical statement in the program.


Can you create dozens of different VMs by using a virtualization program?

yes


What is the best way for a small independent web hosting company to get new customers?

Create an affiliate program or join a program to create an affiliate program for you then advertise your affiliate program to web masters. Create different ad copy of banner and text that will best spread your brand and sales.


Do you make different dogs out of chemicals?

No, I do not create physical objects or organisms. I am a computer program designed to provide information and assistance to users like you. If you have any questions or need help with something, feel free to ask!


Can database programs create graphics?

You can create charts with them, but other than that you cannot create graphics with a database. They are not designed for dealing with graphics, so you would use a different program to create graphics.


Why do you create an object in programmig language?

Objects allow you to create new data types. They also help you separate parts of the program, and give additional benefits, such as being able to use the powerful concept of inheritance.


A class in a program whose objects are created and destroyed throughout the program It is desired that the total number of live objects in the program be known how you do this in C plus plus?

Create a static member variable to contain the count. This variable is common to all instances of the class.Initialize that variable to zero at the beginning of the program.In the class constructor, increment the variable.In the class destructor, decrement the variable.


When friction is created between 2 objects the objects create?

When friction is createed between two objects, the objects create static electricity! :D


What are Objects that create light are said to be?

Self-luminous objects.


How can you use some features of a class without inheritance?

You can create a class that does not inherit from anything and nothing inherits from it. You can then create objects from that class. This allows you to encapsulate and abstract data and methods into a simple interface to be used elsewhere in your program.


Different objects you can use to create different effects on a monoprint?

You can use objects like feathers, leaves, mesh fabric, string, or stencils to create various textures and effects on a monoprint. Each object can produce unique patterns when pressed onto the printing plate, allowing for a diverse range of artistic outcomes.


Why do you need a database?

is a program that allows you to create and managedatabases. Adatabase is a place where you can store information related to a specific topic. How you intend to use the information will determine whether you need an Access database or a different program to create and manage your data