Watch AI Voiceover Videos

Search AI Voiceover Videos

प्रेरणादायक विचार



 

  1. सपनों को सच करने के लिए पहला कदम उठाना ज़रूरी है।

    • हर बड़ा सफर एक छोटे कदम से शुरू होता है।
  2. समय सबसे बड़ा शिक्षक है, इसे व्यर्थ न जाने दें।

    • समय की कीमत समझें और उसे सही दिशा में लगाएं।
  3. असफलता सफलता की सीढ़ी है।

    • हर हार से सीखकर आगे बढ़ें।
  4. जो लोग मेहनत से डरते हैं, वे सफलता का स्वाद नहीं चख सकते।

    • निरंतर प्रयास ही जीत की कुंजी है।
  5. खुद पर विश्वास रखें, आधी लड़ाई वहीं जीत जाएंगे।

    • आत्मविश्वास सबसे बड़ी ताकत है।
  6. हर सुबह एक नया अवसर लेकर आती है।

    • कल की गलतियों से सीखें और आज को बेहतर बनाएं।
  7. छोटी सोच से बड़े सपने नहीं देखे जा सकते।

    • अपने दायरे को बढ़ाएं और ऊंचा सोचें।
  8. जो खुद को बदल सकता है, वही दुनिया बदल सकता है।

    • सुधार की शुरुआत खुद से करें।
  9. परिस्थितियां कैसी भी हों, अपने लक्ष्य को मत छोड़ें।

    • मुश्किलें केवल आपको मजबूत बनाती हैं।
  10. हार मान लेना स्थाई असफलता है।

  • कोशिश जारी रखें, सफलता जरूर मिलेगी।
  1. सकारात्मक सोच से जीवन में चमत्कार होते हैं।
  • नेगेटिविटी को दूर रखें।
  1. अपने कर्म पर ध्यान दें, फल अपने आप मिल जाएगा।
  • गीता का यही सन्देश है।
  1. ज्ञान सबसे बड़ा धन है, इसे हर रोज़ बढ़ाएं।
  • सीखना कभी बंद न करें।
  1. हर किसी के पास 24 घंटे हैं, इसे wisely इस्तेमाल करें।
  • समय प्रबंधन सफलता की कुंजी है।
  1. जो कठिनाइयों से नहीं डरता, वही असली विजेता है।
  • चुनौतियों को अवसर मानें।
  1. शांत मन ही सही निर्णय ले सकता है।
  • धैर्य रखें और समझदारी से काम लें।
  1. छोटे बदलाव भी बड़ा अंतर ला सकते हैं।
  • लगातार छोटे प्रयास करें।
  1. सपने देखने की हिम्मत करें और उन्हें पूरा करने का साहस रखें।
  • डर को पीछे छोड़ें।
  1. आपका आज ही आपका भविष्य बनाता है।
  • आज को बेहतर बनाने पर ध्यान दें।
  1. कभी-कभी पीछे हटना भी आगे बढ़ने का हिस्सा होता है।
  • सही समय पर सही कदम उठाएं।
  1. आपकी मेहनत आपकी पहचान बनाती है।
  • परिणाम के बजाय प्रक्रिया पर ध्यान दें।
  1. जो मुश्किलों का सामना करता है, वही इतिहास रचता है।
  • संघर्ष को गले लगाएं।
  1. आपका नज़रिया आपकी ऊंचाई तय करता है।
  • हमेशा सकारात्मक दृष्टिकोण रखें।
  1. जिंदगी एक किताब है, हर दिन एक नया पन्ना।
  • इसे दिलचस्प बनाएं।
  1. हर किसी के पास छुपी हुई प्रतिभा होती है, उसे खोजें।
  • अपने अंदर के हुनर को पहचानें।

इन प्रेरणादायक विचारों को अपनाकर आप अपने जीवन को नई दिशा दे सकते हैं। ✨

10 basic Java interview questions with their answers



 

1. What is Java?

Answer:
Java is a high-level, object-oriented programming language developed by Sun Microsystems (now owned by Oracle). It is platform-independent due to its "Write Once, Run Anywhere" (WORA) capability achieved through the Java Virtual Machine (JVM).


2. What are the key features of Java?

Answer:

  • Object-Oriented: Everything in Java is treated as an object.
  • Platform-Independent: Java code runs on any platform that supports JVM.
  • Robust: Provides strong memory management and exception handling.
  • Multithreaded: Supports concurrent execution of two or more threads.
  • Secure: Includes security features like cryptography and runtime checks.




3. What is the difference between JDK, JRE, and JVM?

Answer:

  • JDK (Java Development Kit): Includes tools for developing Java applications, like compilers and libraries.
  • JRE (Java Runtime Environment): Provides libraries and JVM to run Java applications.
  • JVM (Java Virtual Machine): Executes Java bytecode and ensures platform independence.

4. What is the difference between == and .equals() in Java?

Answer:

  • ==: Compares memory references (address) of two objects.
  • .equals(): Compares the content of two objects (e.g., strings).

5. What are the data types in Java?

Answer: Java has two types of data types:

  • Primitive: int, float, double, boolean, char, byte, short, long.
  • Non-Primitive: Arrays, Strings, Classes, Interfaces, etc.

6. What is the difference between Array and ArrayList?

Answer:

  • Array: Fixed size, can store elements of the same type.
  • ArrayList: Dynamic size, part of Java's Collection framework, can store objects.

7. What is an object in Java?

Answer: An object is an instance of a class that has states (fields/attributes) and behaviors (methods). For example, a car object has attributes like color and speed, and methods like drive and brake.


8. What is a constructor in Java?

Answer: A constructor is a special method used to initialize objects. It has the same name as the class and no return type.
Example:

public class Example {
int value; public Example() { value = 10; // Constructor initializing value } }

9. What is the difference between abstract class and interface?

Answer:

  • Abstract Class: Can have both abstract and concrete methods. Supports inheritance (one class).
  • Interface: All methods are abstract by default (before Java 8). A class can implement multiple interfaces.

10. What is the purpose of the static keyword in Java?

Answer: The static keyword is used to define members (variables or methods) that belong to the class rather than a specific instance.
Example:

class Example {
static int counter = 0; // Shared across all instances }

These are fundamental questions often asked in beginner-level Java interviews.

Internals of database connectivity in java



Java Database Connection

Database connection in java is very important process in JDBC. This post is for demonstrating internals of java database connectivity. In this post we will get to know How to connect with database in java, Java database connectivity, internals of database connectivity in java. I will also give a sample example of java database connectivity.
For database connection we need to import some packages and need to use some special methods. Before getting into deep I will explain about these methods and packages. Following is details of how to connect with database.

Step by step explanation of Java database connection-

1. Import Package-  For creating database connection you need some functions and classes. These functions and classes are found in a package so we need to import that package using "import java.sql.*".

2. Loading Driver-  Driver is required for conversion of sql statements into back end database understandable form and vice versa.
           Class.forName("oracle.jdbc.driver.OracleDriver");
Class.forName is used to register the driver.

3. Create Connection- 
           DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott","tiger");

4. Define SQL stmt in the form of String class's object

5. Send the SQL stmt

6. Excecute the query and get the result


Sample example of java database connectivity-

//STEP 1. Import "java.sql" package
import java.sql.*;

public class dbConnect
{
  // JDBC driver name and database URL
  static final String DRIVER = "com.mysql.jdbc.Driver";
  static final String URL = "jdbc:mysql://localhost/TEST";

 // Database credentials
 static final String USR  = "username";
 static final String PWD = "password";

 public static void main(String[] args) {
 Connection con = null;
 Statement stmtt = null;
 try
    {
     //STEP 2: Register JDBC driver
    Class.forName("com.mysql.jdbc.Driver");

    //STEP 3: Open a connection
    System.out.println("Connecting to database for I/O operation...");
    con = DriverManager.getConnection(URL,USR,PWD);

   //STEP 4: Execute a query
   System.out.println("Statement Creation for I/O operation...");
   stmtt = con.createStatement();
   String sqlstmt;
   sqlstmt = "SELECT id, first, last, age FROM Emp";
   ResultSet rs = stmt.executeQuery(sql);

   //STEP 5: Extracting the data from result set for next operation
   while(rs.next())
       {
        //Retrieve by column name
        int id1  = rs.getInt("id");
        int age2 = rs.getInt("age");
       String first1 = rs.getString("first");
       String last1 = rs.getString("last");

       //Display values
       System.out.print("ID: " + id1);
       System.out.print(", Age: " + age1);
       System.out.print(", First Name: " + first1);
      System.out.println(", Last Name: " + last1);
      }

     //STEP 6: Cleaning - up environment
     rs.close();
     stmtt.close();
     con.close(); 
    }
    catch(SQLException se)
   {
    //Handle errors for JDBC
    se.printStackTrace();
   }
  catch(Exception e)
  {
    //Handle errors for Class.forName  
    e.printStackTrace();
  }
  finally
  {
    //finally block is used for closing all  resources
   try
    {  
     if(stmt!=null)
     stmtt.close();
    }  
     catch(SQLException se2) 
    {
 
    }
   // nothing we can do
  try
  {
   if(con!=null)
   conn.close();
  }
 catch(SQLException se)
  {
    se.printStackTrace();
  }
  //end finally try
  }
  //end try
 System.out.println("bye!");
 }
}



OUTPUT-

It is very important to know, how to execute this program so now let's know it.
Type following command in command line.

C:\> javac dbConnect.java

After execution of this command you will get following result-


Connecting to database First Time...
Statement Creation...
ID: 101, Age:  25, First Name: Vikash, Last Name: Shukla

Id,Age,First Name,Last Name may be different as per records in database.







Internals of Stored Procedure - JDBC



STORED PROCEDURE


This post is very useful to know about internals of Stored Procedure. JDBC is used for database operations in java and Stored procedures are used for eliminating overhead from Java. Internals of Stored-Procedure will cover all the concepts like What is Stored Procedure, What is procedure, When do people prefer Stored Procedure, Advantages and uses of Stored Procedure, Disadvantage or flaws of Stored Procedures, API of Stored Procedure, Types of Procedure etc…
Before knowing about Stored Procedure we should know about What is Procedure? Procedure is nothing, It is a only function or method of database. These database methods contains group of SQL statements. We create procedure using PL/SQL programming.
Stored Procedure is nothing but it is one of the most useful mechanism for creating procedure in the database and called by java program is known as Stored Procedure.
There is a one big question that When do we prefer using Stored-Procedure? The answer of this question is that whenever we want to get allowance, gross salary etc. from database, we don’t need to create any logic to calculate allowance, gross salary in the java program. We will just create a separate procedure for calculating the allowance and gross salary and will get the desired result in our java program.

Advantage of Stored Procedure-

     Using stored Procedure the processing of data at the back-end database would be faster.
   Overhead on the java program can be reduce.
Disadvantage of Stored Procedure-
  Each and every database contains its own syntax of creating procedure. So if we want to change the database it will create problems due to changed syntax of each database. In this case we will need to write procedures again.

Note- Stored Procedure are not supported in M.S. Access (A Microsoft’s Product).
.
java.sql.CallableStatement interface is the API of Stored Procedure in Java.

Types of Stored-Procedure’s


There are 4 types of procedures in java.

1. Zero Parameterized Procedure
2. In-Procedure
3. Out-Procedure
4. In-Out Procedure


Zero Parameterized Procedure:


Those procedure which doesn’t contains any parameter is called Zero Parameterized Procedure.
Example-

SQL> create or replace

2 procedure prc1

3 Is

4 Begin

5 Update abc1 set name='VIKAS' where id=101;

6 End prc1;

7 /

Procedure created.

In-Procedure:

1.It is just like a method of java which is parameterized but void return type.
2. like pass the 'idno' or any conditional data as a parameter..
Example-

SQL> r/

1 create or replace

2 procedure prc2(aa IN number)

3 Is

4 Begin

5 Update abc1 set name='VIKAS' where id=aa;

6* End prc2;

Procedure created.

Out-Procedure:

It is just a method of java which is contains zero parameter return.... like max, min,
count, sum etc.
Example-

SQL> create or replace

2 procedure prc3(abc OUT number)

3 Is

4 Begin

5 Select count(id) into abc from abc1;

6 End prc3;

7 /

Procedure created

In-Out Procedure:

It is just a method of java which is parameterized as well as return type .... like max,
min, count etc.
Example-

SQL> create or replace

2 procedure prc4(x IN number,y OUT number)

3 Is

4 Begin

5 Select max(id) into y from abc1 where id>=x;

6 End prc4;

7 /

Procedure created.


Creating CallableStatement Object:

Following code is for oracle database-

CREATE OR REPLACE PROCEDURE getEmpInfo

(E_ID IN NUMBER, E_FIRST OUT VARCHAR) AS

BEGIN

SELECT first INTO E_FIRST

FROM EmpMaster

WHERE ID = E_ID;

END;


Note: This post is covering all of the fundamentals of stored procedures and related topics. For more details on other related topics, please visit blog-archive.

Thank You

Internals of Java Interface



Interface Internals in JAVA

Little description of java internals about Interface: Some people say, Interface is used to implement the concept of Multiple Inheritance,but purpose of Interface is not implementing the concept of Multiple Inheritance in Java, although it looks like Multiple Inheritance.

Apart from this It is very important to know that why do we need Interface? The answer is that, If we know about the entity, but don't know about the behavior then we need Interface.
A very simple example of Interface is as follows-

interface Animal
 {
   void eat ();
  }
class Goat implements Animal
  {
    Void eat ()
      {
        System.out.println("Goat is eating grass");
      }
  }
class Dog implements Animal
  {
       void eat()
       {
         System.out.println("Dog is barking");
       }
 }

Some important points for Interface-
1. Interface is a contract.
2. Interface is a contract between service provider and service utilizer.
3. Interface is a keyword of Java.
4. Interface is a user defined data type.
5. Interface is a reference data type.
6. Interface is also structure of java, because it generate .class file. i.e byte code.
7. Interface is the collection of zero or more than zero abstract method and zero or more           than zero final variable.
8. Object of Interface cannot be created.
9. Interface is a pure abstract class, because it only contains abstract method, not any               concrete method. 
10. Interface is a pure SUPER class.

Characteristics of Interface-
1. Method of Interface by default is an abstract.
2. Each and every method of Interface by default declared as a 'public abstract'. If you don't declare Interface as a public abstract,then it is duty of Java Compiler to use 'public abstract' with each method Interface. If we use any other access specifier with Interface method then compile time error is generated.
3. Each and every variable of Interface must be declared as 'public static final', if you don't use then it is duty of Java Compiler to use 'public static final' with each variable of Interface.

Note- 'implements' keyword is used to implement the property of interface in the class.

Working with JAVA Interface

There are some variations which are as follows-

1. One Interface extends another Interface

interface I1
{
}

interface I2 extends I1
{
}

2.one interface can extends zero or more than zero interface.

interface I1
{
}

interface I2
{
}

interface I3
{
}
interface I4 extends I1,I2,I3
{
}

3.one interface cannot extends/implement any class.

4.one class extends only one class and implements zero or more than zero interface.

class H
{
}

class J extends H implements I1,I2,I3,I4
{
}


Keywords used with Interface


1. public
2. abstract
3. default(by default)
4. strictfp
5. public abstract/abstract public


Older Posts Home