Tuesday, 7 February 2017

OPERATIONS ON STRINGS

// OPERATIONS ON STRINGS


class StringDemo2{
public static void main(String[] args){
String str=new String("hello");
System.out.println(str+1+2+3);
System.out.println(1+str+2+3);
System.out.println(1+2+str+3);
System.out.println(1+2+3+str);
}
}

Out put:
hello123
1hello23
3hello3
6hello

No comments:

Post a Comment