Java programming language is a high level, object oriented and general purpose computer programming language. Java is similar to C++ but something is completely different from C++ Using java you can write computer applications , games, utility software and also java is a platform for android OS and its applications.
Logical Complement and Negation Operators
Increment and Decrement Operators
Compound Assignment Operators
The if-then Statement
The if-then-else Statement
The switch Statement
The while Statement
The do-while Statement
The for Statement
Adding Optional Labels
The break Statement
The continue Statement
The String Pool
Important String Methods
Mutability and Chaining
Creating a StringBuilder
Important StringBuilder Methods
StringBuilder vs. StringBuffer
Creating an Array of Primitives
Creating an Array with Reference Variables
Using an Array
Creating an ArrayList
Using an ArrayList
Converting Between array and List
Creating Dates and Times
Manipulating Dates and Times
Working with Periods
Formatting Dates and Times
Parsing Dates and Times
Optional Exception List
Default (Package Private) Access
Designing Static Methods and Fields
Calling a Static Variable or Method
Static vs. Instance
Order of Initialization
Creating Immutable Classes
Extending a Class
Applying Class Access Modifiers
Creating Java Objects
Calling Inherited Class Members
Defining an Abstract Class
Creating a Concrete Class
Extending an Abstract Class
Defining an Interface
Inheriting an Interface
Default Interface Methods
Static Interface Methods
Object vs. Reference
Polymorphism and Method Overriding
The Role of Exceptions
Understanding Exception Types
Throwing an Exception
Adding a finally Block
Catching Various Types of Exceptions
Throwing a Second Exception
Printing an Exception
Local variables are defined in the method and scope of the variables that exist inside the method itself.
Instance variable is defined inside the class and outside the method and the scope of the variables exists throughout the class.
Answer: All Java codes are defined in a Class. It has variables and methods.
Variables are attributes which define the state of a class.
Methods are the place where the exact business logic has to be done. It contains a set of statements (or) instructions to satisfy the particular requirement.
Answer: An instance of a class is called an object. The object has state and behavior.
Whenever the JVM reads the “new()” keyword then it will create an instance of that class.
Answer: OOPs concepts include:
Answer: Inheritance means one class can extend to another class. So that the codes can be reused from one class to another class. The existing class is known as the Super class whereas the derived class is known as a sub class.
Answer: Purpose of Encapsulation:
We are declaring ‘a’ as an integer variable and it should not be negative.
If someone changes the exact variable as “a = -5” then it is bad.
In order to overcome the problem we need to follow the steps below:
So that the above code can be modified as:
The code below shows the getter and setter.
Conditions can be provided while setting the variable.
For encapsulation, we need to make all the instance variables private and create setter and getter for those variables. Which in turn will force others to call the setters rather than access the data directly.
Answer: Polymorphism means many forms.
A single object can refer to the super-class or sub-class depending on the reference type which is called polymorphism.
Using the Manipulation reference type we can call the Addition class “add()” method. This ability is known as Polymorphism. Polymorphism is applicable for overriding and not for overloading.
The alumni of Techpro Education have the opportunity to take their seats in leading companies in the IT industry. Prominent tech corporates hire our candidates for their challenging software tasks.