Spring Framework in Java

What is Spring Framework in JavaThe one of the most popular frameworks for the purpose of application development in Java enterprise is Spring Framework. This development framework is employed by numerous application developer around the globe as it is easy to use application development framework which has the add on factor of code reusability. Moreover, applications built on this framework is easy to test. It is an open source Java enterprise platform. It was released under the license of Apache 2.0 in June 2003. It is an application development framework written by a programmer named Rod Johnson. Spring framework is known for its transparency and bit size. Hence, it can be said that it is a lightweight framework under Java enterprise. The fundamental version…

Continue Reading Spring Framework in Java

Abstraction in Java

What is abstraction in javaAn abstraction is an act of representing essential features and hiding all background details.It is one of the concept of object-oriented programming.It can be achieved by abstract classes or interfaces.Abstract Methods and ClassesA method declared final modifier ensures that it cannot be redefined we can also make the method to be redefined in subclasses by making overriding compulsory.     This is done by using the keyword abstract in the method declaration. When a class carries one or more abstract methods it should also be declared abstract.     An abstract class cannot create an object. The abstract method of an abstract class must be defined in the subclass.     An abstract cannot be used to declare a constructor or static method. Example: abstract class…

Continue Reading Abstraction in Java

Encapsulation in Java

Encapsulation in Java( features of oop ) is the wrapping of data and function into a single entity. It describes the idea of rolling data and methods that task on that data within one crew. It acts as a protective shield to prevent the data accessed by the outside.The encapsulate meaning in hindi is to enclose. Real world example of encapsulation class EncapsulationDemo { private int s; private String empName; private int empAge; public int getEmpS() { return s; } public String gerEmpName() { return empName; } public int getEmpAge() { return empAge; } public void setEmpAge(int newValue) { empAge = newValue; } public void setEmpName(String newValue) { empName = newValue; } public void setEmps(int newValue) { s= newValue; } } public class EncapsTest…

Continue Reading Encapsulation in Java

Polymorphism in Java

Polymorphism in java is the ability of an entity to take several forms or performing single action at different times. As it was named Poly means many and morph means one or more forms, so that we can know polymorphism means many forms. Which means an object showing different behaviors at different times. For example, a person can be a son, student, employee, husband, and father, he is playing different roles in the different situation he is changing the behavior according to the point of the time. Polymorphism is often classified into two types Static Polymorphism (Compile time polymorphism)Dynamic Polymorphism (Runtime polymorphism) Static Polymorphism The static polymorphism will be resolved during the compiler time so that it was also called the Compile time Polymorphism.…

Continue Reading Polymorphism in Java

LIKE and BETWEEN in SQL

To compare values in a database, the LIKE and BETWEEN operators in SQL are used. In this tutorial segment, we will talk about: In SQL, LIKEIn SQL BETWEEN LIKE The SQL Operator In SQL, LIKE is used to retrieve documents when there is a clear pattern. For starters, imagine that we want to extract the name of an individual which includes 'john'. So, if there are three individuals called Johnathan, Johnny, and Marcus, then we can extract records where the names are Johnathan and Johnny with the aid of the LIKE in SQL, as they have the appropriate pattern present in them. In SQL, LIKE is used for wildcard characters, such as: Percentage symbol: This is a replacement for a character of zero, one,…

Continue Reading LIKE and BETWEEN in SQL

Group by and Order by in sql

We can learn how to use group by and order by in sql in this SQL tutorial. In SQL, Group By is used to organize related data into classes, and in SQL, Order By is used to arrange data in an ascending or descending order. which sql keyword is used to sort the result-set? Order By in SQL SQL Order By is used for the ascending or descending order of data sorting. It filters the data by default in ascending order. We use the DESC keyword to identify the data in descending order. Syntax of Order By in SQL: SELECT column1,column2,.... FROM table_name ORDER BY column1 ASC/DESC, column2 ASC/DESC; EXAMPLE: Filter all learners by the column "marks" in the ascending order in SQL. SELECT…

Continue Reading Group by and Order by in sql

Inheritance in Java

It is concept of Java where attributes and methods are inherited from super to sub-class.Let us first clear about super class and sub- class:Super class: The class which is being inherited.It is also referred as parent class.Sub-class: The class which inherits the super class. it is also called as child class.The keyword "extends" is used to inherit from a class. Syntax: public child class extends parent class { //properties and methods } IS-A relationship is demonstrated by Inheritance which can be referred as parent-child relationship. Types of Inheritance We have following types of inheritance. Single InheritanceMulti-Level InheritanceHierarchical InheritanceMultiple InheritanceHybrid Inheritance Single Inheritance In single inheritance, single child class inherits from single parent class. Single Inheritance class farmers { String crops="Wheat"; void grows(); { System.out.println(“Farmers…

Continue Reading Inheritance in Java

Strings (Part-2) in Java

Hash code() It is a method of String Class which is used to return the value of hash code of the instance of string. It is frequently used in Java and its return type is integer. Basically Hashmap and HashSet uses hashing to manipulate data. This hash code represents the integer representation of memory address. If content of two string objects is same, then calling the hashcode() method, both objects must return the same value of hash code but not necessarily vice versa. Example: String Str1 = new String("Hello World"); String Str2 = new String("Hello World"); System.out.println("Hashcode for Str1 :" + Str1.hashCode() ); System.out.println("Hashcode for Str2 :" + Str2.hashCode() ); Returns: Hashcode for Str1 :-862545276 Hashcode for Str2 :-862545276 StringBuffer StringBuffer is a class…

Continue Reading Strings (Part-2) in Java

Strings (Part-1) in Java

Strings are the sequence of characters. Unlike primitive data types like int, float or Boolean, non-primitive data types are not defined by the language, but are constructed by the programmer. These data types refer to a memory’s location which keeps the value or data so they are also called "reference type," or "object type". String is also one of the non- primitive data type. String Class Java platform provides predefined class known as STRING. String variables or String objects are the objects or instances of class java.lang.String. This String class show character strings like “Hello”. All these strings are defined as objects of this class. String Object String variables are the object or instance of Class String. There are two method for create string…

Continue Reading Strings (Part-1) in Java

Nested Class in Java

Nested classes can be precisely defined as classes within a class, a member of an other class. Let’s discuss below with an example for clear understanding, class OuterClass { int abc; //Field as a member void methodOfOuterClass() { //method of outer class } class NestedClass { //Nested Class } } Nested classes are classified into two types: Static Nested Classes 2. Non-Static Nested Classes or Inner Classes Let’s discuss each topic in detail below: Static Nested Classes If we declare the nested classes as static then the classes are known as static Nested Classes. class OuterClass { int staticNestedClass; //Field as a member void methodOfOuterClass() { //method of outer class } static class NestedClass { //Nested class as a member which is declared as static…

Continue Reading Nested Class in Java

Enums in Java

Enums in java actually means grouping same kind of constants as a one unit/package. Constants which are static and final.Enums are added as feature from JDK 1.5 and above. Lets get an clear idea of enums from below examples. class WithoutEnums {     public static final String north = "NORTH";     public static final String south = "SOUTH";     public static final String east = "EAST";     public static final String west = "WEST"; }   public class MainClass {   public static void main(String[] args)   {     System.out.println(WithoutEnums.north);     System.out.println(WithoutEnums.south);    System.out.println(WithoutEnums.east);      System.out.println(WithoutEnums.west);    } } The above examples is without using the concept of enums. Lets see how to declare constants using enums. enum POLES {     NORTH, SOUTH, EAST, WEST; }   public class EnumsExample {     public static void main(String[] args)…

Continue Reading Enums in Java

Wrapper classes(Part-3) in Java

ValueOf() method In java, wrapper class has three kinds of methods for ValueOf() in which; Primitive type is taken as argumentString type is taken as argumentString and int type, both taken as argument at once In these methods, primitive values is boxed or wrapped into objects of wrapper class. Primitive type is taken as argument As name suggests, data of primitive type is taken as argument here, and compatible object of wrapper class is returned. This method looks like;“public static return_type valueOf (primitive_type)” Note: here, return_type can be any class of wrapper. 2. String type is taken as argument As name suggests, data of straing type is taken as argument here, and compatible object of wrapper class is returned. It sends a NumberFormatException in…

Continue Reading Wrapper classes(Part-3) in Java

Wrapper classes (Part-2) in Java

Remaining part of Wrapper class you can study from link:https://codingsmania.in/wrapper-classespart-1-in-java/ 4. Byte Class Methods Int CompareTo(Byte b): This method compares the value of Byte object with the value to ‘b’ argument and will return numerical values. If values are same then it will return ‘0’, if Byte object value is less than ‘b’ then will return some negative value otherwise returns positive value. Boolean equals(Object b): This method will return true if Byte object have same value as object b, otherwise will return false. Static byte parseByte(String s): This method will return valid byte value of string s. Static Byte ValueOf(Byte b): This method will return an object of type Byte by converting it into value of b. Short ShortValue(): This method will covert…

Continue Reading Wrapper classes (Part-2) in Java

Wrapper Classes(Part-1) in Java

There a eight primitive data types in java. These primitive types are dedicated to the classes which are called wrapper classes. As the name shows wrapper classes wraps the primitive data type. It uses primitive data types to represent as an object of that class.For example: for int , there is Integer wrapper class, for float, there is Float wrapper class.Wrapper classes stores the same values as primitive types store but the difference is that these are classes and have instances in primitive types forms. These classes are used to make objects of the form of encapsulated primitive data types and to use inherited methods.Wrapper classes are imported from java.lang package. Methods and Constructors 1. Integer class methods parseInt(String s): This method returns the…

Continue Reading Wrapper Classes(Part-1) in Java

Generics in Java

Why we need Generics? Generics in java is a concept which allows the users to choose the reference type that a method, constructor of a class accepts. By the usage of generics, we can enable a class interface and method accepts all types as parameters. Please check out the below example: Class Generics { Integer work; Generics(Integer work){ this.work=work; } public void display() { system.out.println(“Working hours: “this.work); } } public class GenericsMain { public static void main (String args[] ) { Generics generic=new Generics(10); generic.display(); } } Generic class A class is generic if it declares one or more type variables. In the example we are using the E type parameter to create the generic class of specific type. Class Worker { E obg;…

Continue Reading Generics in Java

JAVA 8

Java 8 is one of the Java versions that brought with it some new features that are considered as revolutionary for computer science and coders (developers) using this language. It is considered the major version released for java after the java 5. Java 8 was released on March 18th, 2014. It contains a huge number of new features and upgrades to ease the use of this programming language and improve the programming technics and security for their users.The major features include in this new release of java are: The Lambda expressions, concurrent accumulator, Method references, default method, new stream API, new Date & time API, The ability to remove the permanent generation…etcIn this introductory chapter, we’ll talk about those major new features added to…

Continue Reading JAVA 8

Multi-Threading In Java

What is a Thread? A thread is a stream of control within a program that can be executed independently. Hence, a single process can be comprised of numerous threads. For instance, in a multithreaded process, there may be different tasks that are fully abled to be run concurrently, like printing the document and running the GUI at an instant of time. Have a clear idea with a below picture, Multithreading in java If a CPU only has one processor then only one thread is executed at a time and CPU jumps between different threads but on a multiprocessor system, several threads are executed at the same time. They do so by sharing certain resources that enables each thread to see the state of the…

Continue Reading Multi-Threading In Java

JDBC Java

JDBC stands for Java Database Connectivity. It is an application programming interface, API for short.To fully understand the functions of the JDBC, we must first delve into what an API actually is. API, or application programming interface, are the gears under the hood of our modern world. For example, everything today is at reach for the consumer. One can order pizza online, buy clothes, and even order packages. There is a myriad of options in the modern world. However, this still begs the question. What is an API? The API serves as an internal datalink from one database to another that serves its purpose in transferring information. JDBC Drivers The JDBC API is an application programming interface serves as the medium between the client…

Continue Reading JDBC Java

Collections in Java

Almost all programming languages have its own set of collections for making data storage more organized. Python has its own set of collections and C++ has its own STL library. Similarly, Java also has its collections framework to make its data storage part more ordered. Let’s take a deep dive into the world of collections framework in Java. Collection Hierarchy Talking about collection hierarchy in Java, there are mainly four key interfaces in the hierarchy and other classes or interfaces implement or extend them respectively. Those four interfaces are : CollectionListQueue Set Collection Interface Collection interface is the interface at topmost level in the Collection Hierarchy. As it is a interface, we can’t create its object directly. Some key methods of Collection interface are…

Continue Reading Collections in Java

Exception in Java

An exception is an issue that comes up during program execution. If an Anomaly happens, the program's usual flow is interrupted and the program terminates abnormally, which is not recommended, and such exceptions should be controlled. Exception can happen for a variety of reasons. Following are some scenarios where there is an exception. Programmer enter invalid date then exception occurLoss of Network connection can occur exceptionJVM can be out of memory causes exception Let’s discuss with an example below: There are some examples shows the exception in java code which made programmer unpleasant and interrupt in flow of working. Java.Lang.Array Index Out Of Bounds Exception. IndexOutOfBounds Exception Above, Array length is 5 so the last index is 4 (length — 1) then iterates for…

Continue Reading Exception in Java

How to install SQL Server?

Download and Install Microsoft SQL Server Microsoft SQL Server is a Microsoft-developed, relational database management system. The primary function of the product is to store and recall the data as requested by the user or other application. These SQL functions will run over a network, either on the same machine or another. How to Download Microsoft SQL Server? In this section, we'll understand how to download Microsoft SQL Server: Check for Microsoft SQL Server Downloads from the Microsoft site, the site contains two options for free. Developer editionExpress version Installing SQL Server Prerequisites We will first download the Developer version Click Download Now for our SQL Server installation steps and start downloading Install SQL Server Once download is complete, the file will be available…

Continue Reading How to install SQL Server?

Delete and Truncate Query in SQL

The Delete query in SQL only deletes records from the table, and does not allow any description changes, i.e. it just manipulates them. Therefore, it is DML (Data Language Manipulation). The Truncate command in SQL eliminates all rows from a table, i.e. by making changes to the data description, it reinitializes identity. That's why it's a DDL (the Data Description Language). Let's debate it. Delete Command in SQL Essentially the Remove query in SQL is used to remove or erase one or more current records from a list. It is used along with clause Where. Though, in the Delete question the Where condition is optional. How to Delete Table in SQL Syntax: DELETE FROM table_name [WHERE condition]; Where the keywords DELETE, FROM, and WHERE…

Continue Reading Delete and Truncate Query in SQL