What is a reference variable in java? Reference variable in java is a class type variable. In other words, declaring a variable along with class name is nothing but a reference variable. Reference variable stores the address of an object which acts as a way to access an object By using reference variable we can access non static members of the class. If no object is passed into the reference variable then by default null value will be stored . Example class Demo { int a=20; void test(){ System.out.println(“Test Method”); } } class MainApp{ public static void main(String[] args) {…
Author: Akshay Kulkarni
What is a method in java? Method is a collection of executable java statements. In other words, method acts as a container for different java statements. In java, methods mainly perform the operations on data. Methods are The advantage of creating a method is code re-usability which means write once and execute multiple times. Methods make modifications easy. It makes code easy to read and understand. Creating methods reduces boiler-plate code Types of Methods in Java Methods are mainly classified into two types: Pre-defined( Internal) and User-defined (External) methods Predefined Methods: Predefined methods (internal methods or inbuilt methods) are already…
What is a datatype in Java? Datatype represents the type of information. In Java, we store the information based on their datatype. Each of the datatypes has a default value. We know that java is a strongly typed language hence, every variable must be declared with a datatype. Data types are mainly classified into two categories: Primitive and Non-primitive. Primitive Datatype: Primitive data types are present in the form of keywords that are already predefined in Java language. Also, java is said to be a semi-object-oriented programming language as it uses primitive data types. There are a total 8…
Variables in Java Variables are used to store the program data. In other words, a variable acts as a container for the temporary storage of data. By using variables we can transfer the data from front end to back end or vice versa. It is possible to create different types of variables by using appropriate datatype. Java is a strongly typed programming language which means every variable is declared with a data type. Declaring variables in java For creating variables we need to use following steps: Declaration: Declaration is the process of creating new variable by providing appropriate datatype. Data-types…
What is Spring IoC? IoC stands for Inversion of Control. It is the approach of outsourcing the construction and management of objects. In software engineering, Spring IoC is the principle by which control of a program’s objects is transferred to the framework or container. Developers commonly use it in object-oriented programming. Explain the advantages of Spring IoC. We can easily achieve decoupling between objects. Makes it easier to switch between different implementations. It provides greater modularity of a program. We can easily test applications by isolating different components. What is a Spring Bean? A spring bean is a simple Java…
What is the use of a Configuration file? Ans: This file acts as a container for database-related information. Database name, driver name, URL, username, password, etc. We can add database-related information using <property> tag What is the use of dialect property? Ans: The dialect specifies the database used in hibernate application. By using this property, hibernate framework generates the appropriate SQL query based on the database vendor. Dialect property allows developers to connect hibernate applications with any database vendor. <?xml version=”1.0″ encoding=”UTF-8″?> <!DOCTYPE hibernate-configuration PUBLIC “-//Hibernate/Hibernate Configuration DTD 3.0//EN” “http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd”> <!– Version 8 MySQL hiberante-cfg.xml example for Hibernate 5 –>…
What are Variables? Variables are used to program data. It is a temporary storage for different types of values. A JavaScript variable acts as a container for values. Rules for declaring variables JavaScript variables are case-sensitive. This means userName and username will be considered as different variables. Using letters, digits, and special symbols in a variable name like ($) and (_) is possible. We can not start variable names with digits. It is not possible to use any reserved keyword as a variable name. Datatypes in JavaScript Datatype represents the type of information present inside the variable. Basically in JavaScript…
Q: What is JavaScript? Ans: JavaScript is a high-level, object-oriented, multi-paradigm programming language. JavaScript is dynamic and is mainly used to create interactive web pages. JavaScript is a powerful programming language capable of adding or deleting HTML elements, and applying CSS styles dynamically. JavaScript is a client-side programming language. Q: What is the difference between Client side and Server side programming? Ans: Server-Side Programming: The process in which program execution occurs on the server side is known as server-side scripting or programming. Server-side programming plays an important role when dealing with huge amounts of data. Servers are required to store…
Explain members in java. Anything declared inside the class body will be considered a member of a class. Members are mainly classified into two types: Data member Function member. Data members are nothing but variables declared inside the class. Methods of the class will be considered as function members. Members of the class body can be static or non-static DATA MEMBERS: Static variable. Non-static variables. FUNCTION MEMBERS: Static methods. Non-static methods. What are the static members of the class? Members declared along with static keywords are known as static members of the class. Static means a common accessible resource (everyone…
What is Generation Strategy? Hibernate framework can use different strategies to generate primary key values. JPA provides four strategies that generate primary keys programmatically or use database features. We can use @GenratedValue annotation to represent primary key attributes. The following are the primary key generation strategies. GenerationType.AUTO GenerationType.IDENTITY GenerationType.SEQUENCE GenerationType.TABLE GenerationType.AUTO The GenerationType.AUTO is the default generation type and lets the persistence provider choose the generation strategy. If Hibernate is the persistence provider then it selects Generation Strategy based on a specific database vendor. Most of the database vendors use GenerationType.SEQUENCE. GenerationType.IDENTITY This is the easiest generation strategy to generate…
