StringBuffer , SubString ,equals and == concepts in java

StringBuffer , SubString ,equals and == concepts in java
SOURCE : Test.java

public class Test {
static int total=10;
int i[]={0};
public static void main(String[] args) {
int i[]={1};
change(i);
System.out.println(i[0]);
StringBuffer sb1 = new StringBuffer("abc");
StringBuffer sb2 = new StringBuffer("abc");
System.out.println(sb1==sb2);
String s = "abc";
System.out.println(sb1.equals(sb2));
System.out.println("poddar".substring(3));
System.out.println(sb1.equals(s));
}
private static void change(int[]i) {
int j[]={2};
i=j;
}
public Test(){



int temp =this.total;
if(temp>5){
System.out.println(temp);
}
}

}


INPUT




OUTPUT

1
false
false
dar
false







Sandeep Kumar D

Hi, I have written and developed this post so that most of people will be benefited. I'm committed to provide easy and in-depth tutorials on various technologies.I hope it will help you a lot.

- Sandeep Kumar D

Follow Me @Google+




SHARE

    Blogger Comment
    Facebook Comment

0 comments :

Post a Comment