answersLogoWhite

0


Best Answer

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

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program in java show how different string Class construcotrs are used to create string objects?
Write your answer...
Submit
Still have questions?
magnify glass
imp
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


Why do convex mirrors always form the same image?

They do not always create the same image. They have different focal points and objects at different distances which create an image different from the object in magnitude or orientation.


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.


When objects vibrate they create?

When objects vibrate they create sound because sound is just the vibrations of objects


When friction is created between 2 objects the objects create?

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


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.


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.


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


Process that combines a variety of materials or objects to create a sculpture.?

Grouping a variety of materials or objects to create a sculpture is called assemblage.