Posts

Showing posts with the label java

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...

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 ve...

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 thi...

List of all keywords and reserved words in java

Java Keywords What is a keyword? Keyword is a special word/reserved word which is already defined in the compiler. We can not use keywords in our program for declaring any variable or program name or in other declarations. Keywords definition is defined in the compiler. For example, If you try to declare a variable with name 'try' that is not possible as 'try' is a keyword in java language. See following example.      class Testpgm  {     int try; //this variable can not be declared....     public static void main (String[] args )       {        //class code....       }    }   Below is lists of all Java keywords- There are 53 keywords in java. 1. 48 special words. 2. 3 special words. 3. 2 unused words. 2 unused keywords ================ 1. goto 2. const 3 reserve words =============== 1. null 2. true 3. false 48 special words ================ keywo...

What does Java Compiler do

Job of Java Compiler Before knowing What does Java Compiler do or Job of Java Compiler, You should know What is a compiler? Compiler is a collection of predefined programs which convert source code into machine understandable code. In case of Java Compiler source code is not converted into machine code  directly , It is first converted into Byte code then translated into machine code by JVM . But other compiler directly convert source code into machine code. For ex- 'C' Compiler. Due to this feature of Java, It is a Platform Independent Language . Java has both the Compiler and Interpreter. Compiler converts source code into byte code and the Interpreted i.e. JVM converts byte code into machine code. Job of Java Compiler- 1. Java Compiler loads source code from Hard Disk to RAM. 2. Java Compiler converts source code into Intermediate code if source code is syntactically     correct. 3. Generate Byte Code i.e.  .Class file. Note-   By defaul...

Internal mechanism of Platform Independent Language

Platform Independence means that no dependency on Platform. Here Platform mean is environment.We will know here Internal mechanism of Platform Independent Language. Learning Java is too easy but understanding it some what difficult. Any one can create programs on java but very few people know the Internal mechanism of java concepts. In this post we are going to discuss about Internal mechanism of Platform Independent Language. As we are discussing on Java and Java is also a Platform Independent Language. So I will explain Internal meaning of Platform Independence and What is the meaning of Platform Independent Language? First of all think only one thing  that can you execute java program made in windows environment on Unix environment or vice versa? If you are unable to answer, I tell you. 'Yes' we can execute java program in any environment. For this only one thing is needed that is called JVM. Java's most powerful feature is that program written in java can we run on an...

Internals of Stream in Java

Why do we need Stream? As we know that Stream is a sequence of data. So we need need this Stream to access data so that we could do I/O operation on that data. Below are some reasons which will tell us why do we need stream. 1)In order to perform input/output operation ,we need Stream. 2)Without Stream ,we cannot perform input/output operation. 3)To save your output and input in the hard-disk permanently,we need Stream. Example ======= Banking Application(Before came to the concept of database, developer used STREAM for developed bank application or etc).

Internal mechanism of File Handling in java

Internals of File Handling in Java File Handling is a very important topic in java. We can read, write, update files through file handling. It gives us authority to modify files through this mechanism. We will read here internal mechanism of file handling. How files are being read, How Input/Output operation are being performed on file. In order to read about all this we need to understand STREAM. We will discuss here-   * Why do we need Stream?   *What is Stream?   *What is INPUT?   *What is OUTPUT?   *What is Input Stream?   *What is Output Stream?   *What is Byte Stream?   *Why do we need Byte Stream?   *What is Character Stream?   *Why do we need Character Stream?   *How many ways to take Input from keyboard? We will get all answer here while reading all posts. First I would like to tell you concept of File Handling. File Handling- We can  read or write som...

static method void return type with zero parameter

Static method with Void Return type with zero parameter in java : This tutorial is provided to understand the mean of void return type with zero parameter.In java, there are three types of methods namely- 1)  Void return type. 2)  Primitive return type 3) reference  return type.  Void return type means a method which returns no value and zero parameter means no parameter is passed within the method. Let's demonstrate void return type method with zero parameter in java. Program for this tutorial is given below- class Sm1 { static void abc() {        System.out.println("inside static method of abc");  }  } class  Test { public static void main(String[] args)  { Sm1.abc(); } } Explanation: abc() is a staic method in this program i.e. it can be called without creating object of this class. So we called it with class name i.e. Sm1. abc() is not returning any type of value so its...