Skip to main content

Posts

Showing posts from October, 2014

Backup & Restore Database

MySQL database backup/restore with Java Program ? Hi! This article is about creating a java program to backup/restore a MySQL database. The article is in two basic parts, namely Backup  & Restore . 1. Backup - Basically, the MYSQL command to backup database looks like follows. 1 mysqldump -u [username] -p[ password ] -B [dbname] -r [MYSQL file Path] The following Code is for the java program. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 public class Main{       public void restoreDB(String path){        String executeCmd = "C:/xampp/mysql/bin/mysqldump -u xyz -pxxyyzz -B myDB -r " + path;        System.out.println(executeCmd);        Process runtimeProcess;        try...

Webinar:

Webinar: What's New in Java 8 In our 2014 Developer Survey Report , we learned that Java is still the leading programming language, with 49% of developers surveyed wanting training on Java in the next three to 15 months. Oracle recently released Java 8, calling it “a major feature release”. Due to the changes incorporated in Java 8, we thought it would be helpful to offer a webinar discussing the features of Java 8 and how the changes will affect your day-to-day programming. In partnership with AMD, we’re excited to offer our What’s New in Java 8 webinar on Wednesday, August 20, 2014 at 10:00am MDT. Register here for the webinar presented by our instructor, Marnie Knue. Marnie will discuss changes in features such as Lambda Expressions, Java Date-Time Packages, and IO and NIO.

Method Overriding in Java

Method Overriding in Java                  If subclass (child class) has the same method as declared in the parent class, it is known as method overriding .In other words, If subclass provides the specific implementation of the method that has been provided by one of its parent class, it is known as Method Overriding. Advantage of Java Method Overriding Method Overriding is used to provide specific implementation of a method that is already provided by its super class. Method Overriding is used for Runtime Polymorphism Rules for Method Overriding method must have same name as in the parent class method must have same parameter as in the parent class. must be IS-A relationship (inheritance). Understanding the problem without method overriding Let's understand the problem that we may face in the program if we don't use method overriding.    class  Vehicle{  ...

Threads in Java

Introduction to Threads          A thread is an independent path of execution within a program . Many threads can run concurrently within a program. Every thread in Java is created and controlled by the java.lang.Thread class . A Java program can have many threads, and these threads can run concurrently, either asynchronously or synchronously. Life Cycle of a Thread: A thread goes through various stages in its life cycle. For example, a thread is born, started, runs, and then dies. Following diagram shows complete life cycle of a thread. Above-mentioned stages are explained here: New: A new thread begins its life cycle in the new state. It remains in this state until the program starts the thread. It is also referred to as a born thread. Runnable: After a newly born thread is started, the thread becomes runnable. A thread in this state is considered to be executing its task. Waiting: Sometimes, a thread transitions to the wai...

Pascal Triangle Program

Pascal Trinangle:                           public class Pascal {         public static void main(String[] args) {                 int i=1;         int j=1;         for (i=1;i<=5;i++)         {             for(j=1;j<=i;j++)             {                 System.out.print(j);             }             System.out.println();       ...