Page 267 - IT-802_class_12
P. 267

while (rs.next()){

                          for (int i = 1; i <=5; i++){

                                 System.out.print (rs.getString (i));

                                 System.out.print (“i”);
                          }

                          System.out.println();

                 }

                }catch (SQLException ex){
                 System.out.println(ex.getmessage());

               }

              }
            }

















            When you complete running your database program, you can disconnect the MySQL
            Server from NetBeans. Right-click the MySQL Server at localhost:3306 [root] and select Disconnect under the Databases
            node.



                Recap Zone


              Ð Ð Java is a widely used high-level programming language used to develop a variety of computer programs such as database
                applications, desktop applications, web-based apps, mobile applications, and games.
              Ð Ð A variable is a placeholder for data that can change throughout the execution of a program.
              Ð Ð Operators are special symbols that execute specific operations in a programming language.
              Ð Ð The if statement in Java lets us execute a block of code depending upon whether an expression evaluates to true or false.
              Ð Ð The switch statement is used to execute a block of code matching one value out of many possible values.
              Ð Ð The Java while loop is used to execute a set of statements repeatedly based on a given condition.
              Ð Ð The do while statement evaluates the test after executing the body of a loop.
              Ð Ð The for loop is the most widely used Java loop construct.
              Ð Ð A useful tool for effectively identifying/detecting and repairing logical flaws in a program is an assertion.
              Ð Ð A special method member called the constructor method is used to initialize the data members of the class (or any other
                initialization is to be done at time of object creation).





                                                                               Fundamentals of Java Programming  265
   262   263   264   265   266   267   268   269   270   271   272