Page 69 - iPlus_Ver_2.0_class_8
P. 69

7.  public class C7{

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

                              System.out.println(b++ + b++);
                            }}


                 D.  Find the errors in the following Java codes:
                     1.  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);
                              }
                            }

                     2.  public class assignment{
                              public static void main(String[] args){
                                      int a ==10;
                                      System.out.println(a);
                              }
                            }

                     3.  public class D3{
                              public static void main(String[] args){
                              int a = 5;
                              String name = "Chirag";
                              System.out.println(a + name);

                            }
                     4.  public class D4{
                              public static void main(String[] args){
                              System.out("Welcome");

                            }}
                 E.  Competency-based/Application-based questions:

                     1.   Anil wants to increase the value of the variable a by 1 and assigns the value again to the
                        variable a. Which Java operator can help him do this?

                     2.   Naveen wants to display his name on the screen. Which data type of Java can help him do this?





                                                                                                                  67
                                                                                               Program Coding
   64   65   66   67   68   69   70   71   72   73   74