Skip to main content

Posts

Showing posts from September, 2021

Java Programming Lab || IMPLEMENTATION OF CLASS & OBJECTS

  IMPLEMENTATION OF CLASS & OBJECTS College.java import java.io.*; public class College {             String name;             String dept;             int age;             String place;             public College(String name, String dept,int age, String place)             {                         this.name = name;                         this.dept = dept;                         this.age = age;                         this.place = place;             }             public String getName()             {                         return name;             }             public String getDept()             {                         return dept;             }             public int getAge()             {                         return age;             }                public String getPlace()             {                         return place;             } public String display()             { return("Name :"+ t

PROGRAMMING IN JAVA || USE INTERFACES

    II BCA -  CORE PAPER 3 PROGRAMMING IN JAVA USE INTERFACES Contents: Java Interface Need for Java interface Declaring an Interface Relationship between Interface & class Declaring Interface Constants  Java Interface ·          The interface in Java is  a mechanism to achieve  abstraction that specify what a class must do  without saying anything about how the class will do it. ·          An interface can be defined as a container that stores the methods to be implemented in the code segment. ·          An interface can have methods and variables just like the class but the methods declared in interface are by default abstract. ·          The variables declared in an interface are public, static & final by default. Need for Java interface There are mainly three reasons to use interface. 1.        It is used to achieve abstraction. 2.       By interface, we can support the functionality of multiple inheritances. 3.       It can be used to achieve lo

PROGRAMMING IN JAVA || UNIT 1- || DEFINE CLASS

  II BCA -  CORE PAPER 3 PROGRAMMING IN JAVA UNIT 1 DEFINE CLASS Java Class   ·         A  Java Class  is like a  wrapper or envelope  that comprises a number of Methods and Variables. ·         A class defines the properties and behavior of an object. ·         In Java class, the variables represent the properties of the object and the methods that represent the behavior of the object. ·         A Java program consists of a CLASS with some Methods & Variable. Java Class Syntax Java classes defined in the following way: class MyClass {             // fields,             // constructor, and             // method declarations             } Java class declarations can include the following components: 1.       Modifiers such as  public ,  private (the  private  modifier can only be applied to  Nested Classes .) 2.     The class name, with the initial letter capitalized by convention. 3.     The name of the class's parent (superclass), if any, prece