Object reference: Object reference is unique hexadecimal number representing the memory address
of the object, it is useful to access the members of the object.
//Creating String
Creating a string in java three ways.
* String s;
declare string type after next line insitialize
s="hello" group of charactor
* String s="hello"; //declare and initialize(both)
s is reference variable
String class by allocated the memory using the new operator
just like a creating a object .such as
* String object =new String("hello");
class CreateString
{
public static void main(String[]args)
{
String s="hello shashi";
System.out.println(s);
String s2=new String("shashikant");
System.out.println(s2);
}
}
0 comments:
Post a Comment