Skip to content
October 7, 2013 / TDS Software

Write the output of the following Java program. (2 marks)

package javaisfun;

public class JavaIsFun {

public static void main(String[] args) {
String s1 = “Java is Fun!”;
String s2 = new String (“Java is Fun!”);
StringBuffer sb1 = new StringBuffer(“Java is Fun!”);

System.out.println(s1.substring(8)==s1.substring(8,11));
System.out.println(Character.isUpperCase(s1.toUpperCase().charAt(4)));
System.out.println(sb1.delete(3,6).charAt(3)!= s2.charAt(3));
System.out.println(sb1.reverse().append(“Java”).lastIndexOf(“Java”));
}
}

 

false
false
true
9

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: