Girl in IT-wolrd

Everything has been downloaded. Quit download loop.

Category Archives: Java Interview Q&A

Java Interview. Autoboxing.

1 Что такое autoboxing?
Автоупаковка это механизм неявной инициализации объектов классов-оберток (Byte, Short, Character, Integer, Long, Float, Double) значениями соответствующих им исходных примитивных типов (соотв. byte, short, char, int, long, float, double), без явного использования конструктора класса.
Автоупаковка происходит при прямом присвоении примитива — классу-обертке (с помощью оператора”=”), либо при передаче примитива в параметры метода (типа «класса-обертки»). Автоупаковке в «классы-обертки» могут быть подвергнуты как переменные примитивных типов, так и константы времени компиляции(литералы и final-примитивы). При этом литералы должны быть синтаксически корректными для инициализации переменной исходного примитивного типа.
Read more of this post


Java Interview Q&A. Exception Handling.[52-81/240]

52) What is an exception in java?
In java exception is an object. Exceptions are created when an abnormal situations are arised in our program. Exceptions can be created by JVM or by our application code. All Exception classes are defined in java.lang. In otherwords we can say Exception as run time error. Read more of this post

Java Interview Q&A.Coding Standards.[26-51/240]

Core java Interview questions on Coding Standards

26) Explain Java Coding Standards for classes or Java coding conventions for classes?
Sun has created Java Coding standards or Java Coding Conventions . It is recommended highly to follow java coding standards.
Classnames should start with uppercase letter. Classnames names should be nouns. If Class name is of multiple words then the first letter of inner word must be capital letter.
Ex : Employee, EmployeeDetails, ArrayList, TreeSet, HashSet
Read more of this post

Java Interview Q&A. Java Core.[1-25/240]

This post opens series of posts about Java Core Interview Questions and Answers.

1) what are static blocks and static initializers in Java ?
Static blocks or static initializes are used to initialize static fields in java. we declare static blocks when we want to initialize static fields in our class. Static blocks gets executed exactly once when the class is loaded . Static blocks are executed even before the constructors are executed.

2) How to call one constructor from the other constructor ?
With in the same class if we want to call one constructor from other we use this() method. Based on the number of parameters we pass appropriate this() method is called.
Restrictions for using this method :
1) this must be the first statement in the constructor
2)we cannot use two this() methods in the constructor

Read more of this post