Page 138 - CA_Blue( J )_Class9
P. 138

Let’s Revisit


                        Comments are non-executable statements that are required to explain certain parts of the program or add notes
                       to some parts of the program.
                        In Java, there are three types of comments: single-line comments, multi-line comments and documentation
                       comments.
                        A package in Java can store similar types of Java classes and packages.
                        Calendar is an abstract class of java.util package.
                        We use command-line arguments to input values as strings in the main() method, as it is the first method invoked
                       when the program starts.
                        The Scanner is used to input different types of values while executing a program.
                        All input values taken from the user are initially in the form of strings. These values must be converted to the
                       required data types using appropriate methods.
                        In Java, we may encounter situations or code that result in illegal operations, causing the execution to stop or
                       produce an incorrect output. These issues are known as errors.
                        Testing is the process of identifying errors in the program code.
                        Debugging is the process of fixing the errors found during testing.
                        An exception is an abnormal condition that occurs when a runtime error happens.
                        Exception handling is the process of managing such errors during runtime.





                                                             MIND DRILL





                       Solved Questions



                  A.  Tick ( ) the correct answer.
                     1.  Which of the following is used to include a package in a program written in Java?
                         a.  #include                                   b.  import
                         c.  main()                                     d.  constructor
                     2.  “Division by zero” is an example of ………………….
                         a.  Syntax error                               b.  Logical error
                         c.  Runtime error                              d.  Semantic
                     3.  What is the purpose of the try-catch block in Java?
                         a.  To define variables                        b.  To handle runtime errors and exceptions
                         c.  To declare methods                         d.  To perform mathematical calculations
                     4.  Which of the following is not a type of comments in Java?
                         a.  Single-line                                b.  Double-line
                         c.  Documentation                              d.  Multi-line
                     5.  Double a=4  is a ………………… error.
                         a.  Syntax                                     b.  Runtime
                         c.  Logical                                    d.  Type




                   136    Touchpad Computer Applications-IX
   133   134   135   136   137   138   139   140   141   142   143