Java By Kiran
Java Training Institute in Pune
Java Training Institute in Pune
The = operator is right associative.
A break statement results in the termination of the statement to which it applies (switch, for, do, or while). A continue statement is used to end the current loop iteration and return control to the loop statement
A private variable may only be accessed within the class in which it is declared..
The purpose of the System class is to provide access to system resources.
The eight primitive types are byte, char, short, int, long, float, double, and boolean.
The default value of the boolean type is false.
The dot operator(.) is used to access the instance variables and methods of class objects.It is also used to access classes and sub-packages from a package.
Type casting means treating a variable of one type as though it is another type.
The >> operator carries the sign bit when shifting right. The >>> zero-fills bits that have been shifted out
The range of the short type is -(2^15) to 2^15 - 1.
No, Java does not allow Default Arguments.
Octal Numbers are denoted by leading zero in java
Hexadecimal Numbers are denoted by leading 0x or 0X in java
Yes, an example can be break one
CLASSPATH and PATH are the two variables.
No, there is no need to import this package. It is by default loaded internally by the JVM.
If a class is declared within a class and specify the static modifier, the compiler treats the class just like any other top-level class. Nested top-level class is an Inner class.
There is no difference between J2SDK 1.5 and J2SDK 5.0. Sun Microsystems has just rebranded the versions.
Yes, Java is supported by Windows, Mac as well as UNIX/Linux like Ubuntu, Red Hat and Sun Solaris.
For Unicode 16 bits and ASCII needs 7 bits. However, ASCII is usually represented as 8 bits. UTF-8 presents characters through 8, 16 and 18 bit pattern. UTF-16 will require 16-bit and larger bit patterns.
Yes, it can support more than one Java classes in a condition where one of them is a public class.
It helps in accessing files and directories of a local system.
No, it does not support
Java source code file takes the name of a public class or interface that is defined by the programmer while coding within the file. Source code file may contain maximum one public class or interface in the file. Two cases me occur while naming of the java source code file:
• When public class or interface is defined within a source code file then the java source code file must take the name of the public class or interface defined while coding.
• When no public class or interface is defined inside a source code file, then the java source code file take a name that is different than its classes and interfaces. Source code files use the .java extension.
There are two types of casting:
• Casting between primitive numeric types, and
• Casting between object references.
Casting between numeric types is used to convert larger values, like double values, to smaller values, such as byte values. Casting between object references is used to refer to an object by a compatible class, interface, or array type reference.
Several things happen in a particular order to ensure the object is constructed properly:
1. Memory allocation: To hold all instance variables and implementation-specific data of the object and its super classes.
2. Initialization: the objects are initialized to their default values.
3. Constructor: Constructors call the constructors for its super classes. This process continues until the constructor for java.lang.Object is called, as java.lang.Object is the base class for all objects in java.
4. Execution: Before the body of the constructor is executed all instance variable initializes and initialization blocks must get executed. Then the body of the constructor is executed.
• Within a method variables declared are called “local” variables.
• Variables declared in the class i.e not in any methods are “member” variables (global variables).
• Variables declared in the class i.e not in any methods and are called as “static” are class variables
• JDK stands for Java Development Kit.
It is the most widely used Java Software Development Kit.
• JRE stands for Java Runtime Environment
It is an implementation of the Java Virtual Machine which executes Java programs
• JVM stands for Java Virtual Machine
It is an interpreter.
• JAR files is the acronym stands for Java ARchive fles.
• JAR files allow aggregating many files into one.
• JAR is usually used to hold Java classes in a library.
• WAR files is the acronym stands for Web ARchive fles.
• WAR stores XML, java classes, and JavaServer pages
• WAR is mainly used for Web Application purposes.