Code 1 : class A { A m1() { return new A(); } } class B extends A { /* Valid A m1() { return new A(); } */ ...
Read More
72 How to Create Sub packages in Java?
Code: package com.atharva; public class Demo { public static void main( String args[] ) { System.out.println(" Sub Pac...
Read More
71 How to Create Program on Package in Current Location?
Code : package codingatharva; public class PackageDemo { public static void main( String args[] ) { System.out.println("...
Read More
70 Run time Polymorphism | Dynamic Binding | Late/Lazy Binding
Code : class A { void m1() { System.out.println(" super class m1() "); } } class B extends A { void m1() ...
Read More
69 Compile time polymorphism | Static polymorphism | Early Binding in Java
Code: class Test { static void m1() { System.out.println(" super class Test m1() "); } } class Demo extends Tes...
Read More
67 Method Overriding Rules for Exception in Java
Code: import java.io.*; class A { void m1() throws IOException { } } class B extends A { /* We Can write Same Class Ex...
Read More
66 Method Overriding in Java
Overriding toString() method. Code: package com.ca.atharva; class Student { int sid = 101; String sname = "ram"; ...
Read More
65 Program on Abstract Class, Interface and their Relations in Java ?
Code: interface I { public abstract void m1(); public abstract void m2(); } /* Relation: Interface to Interface */ interface J...
Read More
Subscribe to:
Posts (Atom)