Core Java

Type Casting

Converting one data type into another data type is called `type casting` or simply `casting`. Whenever we assign a value to a variable using assignment operator, the java compiler checks for uniformity and hence the data types at both the sides should be same. If data types are not same, then we should convert the types to become same at the both sides. To convert the data type, we use `cast operator`. Cast operator means writing the data type between simple braces, before a variable or method whose value is to be converted.

Abstract Classes

A class is a model for creating objects, contains description of properties or variables and actions or methods of its objects. If an object has the properties and actions as mentioned in the class, then that object belongs to the class. The rule is that anything is written in the class is applicable to all of its objects. If a method is written in the class, it is available as it is to all of the class objects.

Interfaces

Interface is a class that contains only abstract methods and no concrete methods. This means an interface contains methods which are all abstract and hence none of the methods will have body. Only method prototypes will be written in the interface. So, an interface can be defined as a specification of method prototypes.

Packages in Java

It is necessary in software development to create several classes and interfaces. After creating these classes and interfaces, it is better if they are divided into some groups depending on their relationship. Thus, the classes and interfaces which handle similar or same task are put into the same directory. This directory or folder is also called as 'package'.

Subscribe For More Content