Page 277 - IT-802_class_12
P. 277

(b)    Multi-Line Comments: Multi-line comments enable you to comment on multiple lines or a block of code in Java. They
                     are created by enclosing the comments within /* and */. Anything between these delimiters is considered a comment
                     and is ignored by the compiler.
              16.  Write the operator used to access members of a class object.                                [2022]
             Ans.  The member access (dot) operator (“.”) is used frequently to access a field or to call a method on an object.
              17.  Java compiler translates the Java program into ……………………… .                                  [2022]
             Ans.  Java bytecode
              18.  Expand the term JVM.                                                                        [2022]
             Ans.  Java Virtual Machine
              19.  What is a method?

             Ans.  A method is a set of statements written to accomplish a specific task.                      [2022]
              20.  How many primitive data types does Java support in all?                                     [2022]
             Ans.  Java support 8 primitive data types.
              21.  What is the size of Boolean variable in Java?                                               [2022]
             Ans.  The size of Boolean variable in Java is 1 bit.
              22.  How do the following two codes differ:                                                      [2022]
                  (a)  System.out.print(“Hello World”);
                  (b)  System.out.printIn(“Hello World”);
             Ans.  The first statement (a) print the Hello World and leaves the cursor at the same position. While the second statement (b) print
                 the Hello World and move the cursor to the new line.
              23.  Identify the errors in the following code and write the corrected code:                     [2022]

                 public class iFDemo{,
                 public static void main (String[] args) {.
                 int percentage = 55;
                 String day = “ “;
                 if (percentage >= 40)
                  System.out.printin(“pASSED”); },
                 else;
                 { System.out.printline(“FAiLED”); }
             Ans.  public class iFDemo
                 {
                 public static void main (String[] args)
              {
                 int percentage = 55;
                 String day = “ “;
                 if (percentage >= 40)
                 {
                 System.out.println(“pASSED”);
                 }
                 else
                 {
                 System.out.println(“FAiLED”);
                 }
                 }
                 }

                                                                               Fundamentals of Java Programming  275
   272   273   274   275   276   277   278   279   280   281   282