Category: Uncategorized

  • “final”- KEYWORD

    “final” is a keyword in java which provides code restricted. final can be used with variables, methods and classes. It cannot be used for blocks and constructors.  the “final” keyword in a method declaration to indicate that the method cannot be overridden by subclasses. NOTE: We can also declare an entire class final. A class that is…

  • “static” – KEYWORD

    Why “static”: The static keyword in java is used for the memory management mainly. static keyword is used to save our time and typing. static variables: static variable will have only one copy which will be shared by all objects. EXAMPLE: public class Employee{ int empid; String empname; double salary; char grade; static String companyName=”HCL”;…

  • “this” and “super”- keyword

    “this” keyword: It is to distinguish difference between local and instance data variable when their names are alike/same. “this” is an object of that class. It can also call methods. “this” keyword is optional for a method call within a class. It can refer properties of its own class. Within an instance method or a…

  • CONSTRUCTOR

    Purpose of constructor is to assign values to instance variables at the time of object creation. Constructor gets invoked(to call) at the time of object creation. Constructor looks like a method without return. Constructor name should be class name. TYPES OF CONSTRUCTOR: Default constructor: Default constructor is to assign default values to instance data variables…

  • POLYMORPHISM

    Poly means many.Morphism means forms. Polymorphism is nothing but a method exhibiting different forms. polymorphism refers to a principle in biology in which an organism or species can have many different forms or stages. This principle can also be applied to object-oriented programming and languages like the Java language. Subclasses of a class can define their…

  • INHERITANCE

    In Java, it is possible to inherit attributes and methods from one class to another. We group the “inheritance concept” into two categories: To inherit from a class, use the extends keyword. Types of inheritance: 1.SINGLE INHERITANCE: As the name suggests, this type of inheritance occurs for only a single class. Only one class is derived from…

  • LOOPS: (iteration – Repeated execution)

    Looping in programming languages is a feature which facilitates the execution of a set of instructions/functions repeatedly while some condition evaluates to true. TYPES OF LOOPING STATEMENTS: For loop: A for loop in Java is a repetition control structure which allows us to write a loop that is executed a specific number of times. The for loop…

  • JAVA CONTROL STATEMENTS-CONDITIONAL STATEMENTS

    Java control statements: Java compiler executes the code from top to bottom. The statements in the code are executed according to the order in which they appear. Java provides statements that can be used to control the flow of Java code. Such statements are called control flow statements. These statements decide whether a specific part…

  • METHODS, CLASS AND OBJECT

    METHODS: Methods are nothing but a set of statements/ instructions. It is a behaviour(functionality) of a program. The name of method is used to call (invoke) that method within or outside a class. Once a method is called, the code given inside that method is executed. It has a name followed by a block, that block holds set of instructions /statements. RULES for…

  • TOKENS

    The tokens are the small building blocks of a Java program that are meaningful to the Java. TYPES OF TOKENS: 1. KEYWORDS: Keywords are reserved words. keywords are used to perform specific action. There are approximately 50 keywords. RULES FOR KEYWORDS: LIST OF KEYWORDS: DATA TYPES: Data type specify the size and type of the data.…

Design a site like this with WordPress.com
Get started