Advertisements
Advertisements
प्रश्न
Write the output for the following :
String s1 = “phoenix”; String s2 =”island”;
System.out.prindn (s1.substring(0).concat (s2.substring(2)));
System.out.println(s2.toUpperCase( ));
उत्तर
phoenix land
ISLAND
APPEARS IN
संबंधित प्रश्न
String x[ ] = {“Artificial intelligence”, “IOT”, “Machine learning”, “Big data”};
Give the output of the following statements:
(i) System.out.prindn(x[3]);
(ii) System.out.prindn(x.length);
Write a program to input a sentence and convert it into uppercase and count and display the total number of words starting with a letter ‘A’.
Example:
Sample Input: ADVANCEMENT AND APPLICATION OF INFORMATION TECHNOLOGY ARE EVER CHANGING.
Sample Output: Total number of words starting with letter A’ = 4.
String x[] = {“SAMSUNG”, “NOKIA”, “SONY”, “MICROMAX”, “BLACKBERRY”};
Give the output of the following statements:
- System.out.println(x[1]);
- System.out.println(x[3].length());
Write the output for the following :
String s= “Today is Test”;
System.out.println(s.indexOf(‘T’)); System.out.println(s.substring(0, 7) + ” ” + “Holiday”);
Write the output for the following :
System.out.printIn(“Incredible” + “\n” + “world”);
If int y = 10 then find int z = (++y * (y++ +5));
State the output of the following program segment:
String str1 = “great”; String str2 = “minds”;
System.out.println (str1.substring (0,2).concat(str2.substring (1)));
System.out.println ((“WH”+(str1.substring (2).toUpperCase())));
Rewrite the following program segment using if-else statements instead of the ternary operator:
String grade = (mark >= 90) ? “A” : (mark >= 80) ? “B” : “C”;
Give the output of the following method:
public static void main (String [] args)
{
int a = 5;
a++;
System.out.println(a);
a -= (a--) − (--a);
System.out.println(a);
}
State the value of characteristic and mantissa when the following code is executed:
String s = “4.3756”;
int n = s.indexOf(‘.’);
int characteristic=Integer.parseInt (s.substring (0,n));
int mantissa=Integer.valueOf(s.substring(n+1));