Skip to main content

Posts

Showing posts from July, 2019

What is JDK, JRE and JVM?

What are JDK, JRE, and JVM: JDK :- Java Development Kit (in short JDK) is Kit which provides the environment to Develop and execute(run ) the Java program. For eg. You(as Java Developer) are developing an accounting application on your machine, so what do you going to need into your machine to develop and run this desktop app? You are going to need  J-D-K  for that purpose for this you just need to go to the official website of sun or oracle to download the latest version of JDK into your machine. Hence, JDK is a kit(or package) which includes two things i) Development Tools(to provide an environment to develop your java programs) and ii) JRE (to execute your java program). JDK is only used by Java Developers. JRE: - Java Runtime Environment (to say JRE) is an installation package which provides an environment to only run(not develop) the java program(or application)onto your machine. For eg(continuing with the same example) after developing your accounting application

What are the advantages of Spring MVC over Spring Boot?

Advantages of Spring MVC over Spring Boot Spring MVC is just a pattern that spring framework uses,if you are using spring framework, you are already following spring mvc pattern. If you use spring framework and not following mvc architecture there is no point in using it. So your question must be what are the advantages of spring framework over spring boot. Answer is  NONE. Actually,Spring boot was introduced to get rid of problems that spring framework had. Spring framework is just a skeleton version of all the spring components required to build an application,All the configuration required should be done by yourself. On the other hand,Spring boot acts as a container for spring components in which you will get more features than traditional spring framework such as 1. Embedded Server 2. Auto Configuration 3. Health Check 4. Standalone fat jars and much more You might be under the misunderstanding that Spring MVC and Spring Boot are different frameworks.

What is Java Custom Exception?

Java Custom Exception Custom exceptions  are exceptions that we can create  on our own  by inheriting Exception class. This how we can use all the  functionalities  of the exception class. Java custom exceptions are used to customize the exception according to user need. Here is an example- package com . Akshay . exceptions ; /** @author Akshay Ingole**/ public class InvalidUserNameException extends Exception { private static final long serialVersionUID = 1L ; InvalidUserNameException ( String s ) { super ( s ); } } Now your test program is package com . Akshay . exceptions ; /* * @author Akshay Ingole * */ public class TestException { public static void validateName ( String name ) throws InvalidUserNameException { if ( " " . equalsIgnoreCase ( name ) || null == name ) throw new InvalidUserNameException ( "Name is not valid" ); else System . out . println ( "Hello " + name );

What is singleton design pattern?

Singleton design pattern Singelton Design Pattern.  The singleton design pattern is a software design pattern which ensures that a class of anyone object has only one instance (of computer science). In other words, we can also say that it restricts the instantiation of a class of any object. We require a singleton pattern because it may sometimes happen that we require only one object to coordinate with the action across the system. This concept is also applicable when we have to restrict instantiation over a number of objects. The singleton pattern helps us to solve problems like: Helps to ensure that a class has one instance. Helps to access the sole instance of a class easily. Helps to a class to control its instantiation. Helps to restrict a number of instances of a class. Now, you might be thinking about how to solve such problems. Here are a few key points which might help you: The first key point is to make a class which is responsible by itself for co

How does a hash map work internally in Java?

Hash map work internally in Java Basically, HashMap is an array of Entry class, a static inner class defined in HashMap is as below: static class Entry implements Map. Entry  { final K key; V value; Entry next; final int hash; //getters and setters } Each element in Hashmap stores in it a key, its value, a reference to next entry in case hash value is the same for two entries, in that case, a linked list will be formed. Default initial capacity of a HashMap is 16 i.e a HashMap is initialized with a default 16 sized array. Now, let us see what happens when we put an element into HashMap. Following is the code for put method in hashmap: public V put(K key, V value) { if (key == null) return putForNullKey(value); int hash = hash(key.hashCode()); int i = indexFor(hash, table.length); for (Entry e = table[i]; e != null; e = e.next) { Object k; if (e.hash == hash && ((k = e.key) == key || key.equals(k))) { V oldValue = e.value; e.valu

What are the new features in Java 8?

New features in Java 8 Java 8. The Java 8 release, Java contributed in support for functional programming, enhancement of JavaScript engine, outstanding APIs for date time manipulation, new streaming API, etc. There are dozens of notable and valuable features in Java 8, but the most significant features are discussed. Out of all features, some are very talked-about amongst developers, while few are not talked about (quiet) features.  Java 8 Features 1. Lambda Expressions As per Java developer's perspective, Lambda expression is one of the significant add-on features to the language. This extended feature brought Java App Development to the forefront of functional programming, just like other functional JVM-based languages - Scala and Clojure. A lambda expression is a function used to create delegates or expression tree types. Using lambda expressions, developers can code local functions which can be passed as arguments or returned as the value of function calls as l

Best tips for writing a resume?

   Resume Tips for writing a resume: Maximum length:  2 pages Use of borders and colors : No Start every sentence with an action verb Include location and duration for each work experience Focus on achievements and not just responsibilities Avoid the use of  'I' Photograph : No Must have : Address, phone number, professional email id, and DOB Marketing lingo : No, keep it simple and straight forward Abbreviations : No Objective : Not required; start with a summary. The objective should be evident Strengths : Not required Hobbies : Not required References upon request:  not required

Some tips for Java interviews?

Tips for Java interviews Well, there are a few things that are common to succeed in any kind of interview. These are self-confidence, listening to the person properly before giving the answer, try to treat the interview as a discussion with a co-worker where both if you are trying to come up with a solution for a problem. Now talking about specifics in java. Try to prepare the most recurring topics like oops, Collection, Exception Handling, Multi-Threading,   etc. Apart from that have a good understanding of Frameworks. Try to come up with a solution for some of the popular Logical problems. Apart from that read through the JD for the job. There might be topics like Spring, Hibernate, REST, SOAP or SQL to be prepared.

How can you prepare to clear any Java interview?

 Some Basic to   prepare and clear any Java interview Most of the time interviewer is looking for a candidate who can work with him. The vacancy may be in other teams but they use this parameter to judge. Mostly this article contains general tips. This is for targeted  2 to 6 years experienced candidates . 1. Be honest and don't bluff Answer what you know, confidently. If you have been asked a question that you don't know, Start by telling "I am not sure, but I think It is .....". Never tell a wrong answer confidently. That will make them doubt your correct answers also or may feel that they were guesses. You can't use this technique for every question, but I would think 25% is a good amount. Most importantly this shows your ability to think and a never die attitude. No one wants to work with people says "I can't do this". Try to do something about all the questions. 2. Be ready to write Code If you are been asked to write some code