मराठी

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); } - Computer Applications

Advertisements
Advertisements

प्रश्न

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);
}
एका वाक्यात उत्तर
Advertisements

उत्तर

The output of this method is 6 and 4.

shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 1.04: Operators in Java - Review Insight [पृष्ठ ४२]

APPEARS IN

अविचल Computer Applications [English] Class 10 ICSE
पाठ 1.04 Operators in Java
Review Insight | Q 4. | पृष्ठ ४२

संबंधित प्रश्‍न

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( ));


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:

  1. System.out.println(x[1]);
  2. System.out.println(x[3].length()); 

What is the function of catch block in exception handling? Where does it appear in a program?


State the output when the following program segment is executed:

String a = "Smartphone", b = "Graphic Art"; 
String h = a.substring(2, 5); 
String k = b.substring(S).toUpperCase(); 
System.out.println(h); 
System.out.println(k.equalsignoreCase(h)); 

Write the output for the following :

System.out.printIn(“Incredible” + “\n” + “world”);


Design a class to overload a function Joystring( )as follows:

(i) void Joystring (String s, char ch1 char ch2) with one string argument and two character arguments that replaces the character argument ch1 with the character argument ch2 in the given string s and prints the new string.
Example:
Input value of s = “TECHNALAGY”
ch1=‘A’,
ch2=‘O’
Output: TECHNOLOGY
(ii) void Joystring (String s) with one string argument that prints the position of the first space and the last space of the given string s.
Example:
Input value of = “Cloud computing means Internet based computing”
Output: First index: 5
Last index: 36
(iii) void Joystring (String s1, String s2) with two string arguments that combines the two string with a space between them and prints the resultant string. Example :
Input value of s1 =“COMMON WEALTH”
Input value of s2 =“GAMES”
Output: COMMON WEALTH GAMES
(use library functions)


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())));


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)); 


Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×