Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 103 - 2617_JSSPS_C-6
P. 103

    4.  public class A1{                                         Write output here:

                                  public static void main(String[] args){
                                  String first_name = "Kittu";
                                  String last_name = "Sharma";
                                  String name = first_name + " " +  last_name;
                                 System.out.println(name);
                                 }
                                }
                            5.  public class B{
                                                                                         Write output here:
                                  public static void main(String[] args){
                                       int age = 17;
                                       age += 1;
                                       age++;
                                       ++age;
                                       System.out.println(age);
                                 }
                                }
                            6.  public class C6{                                         Write output here:
                                  public static void main(String[] args){

                                  int a = 5;
                                  int b = 5;
                                  System.out.println(a > b);
                                  System.out.println(a == b);
                                }}
                            7.  public class C7{                                         Write output here:

                                  public static void main(String args[]){
                                  int a=5;
                                  int b=6;
                                  System.out.println(a++ + ++a);
                                  System.out.println(b++ + b++);
                                }}

                            8.  Find the errors in the following Java codes:
                                a.  public class program{

                                  public static void main(String[] args){
                                       int a = 10;

                                       int b = 20
                                       int c = a + b;
                                       System.out.println("The value of c is: "+c);
                                 }

                                 }

                                                                                  Introduction to Programming in Java  101

| 98 99 100 101 102 103 104 105 106 107 108 |