Monday Revision
package com.company;
//import java.util.Scanner;
interface one{
public void sing();
private void hello(){
System.out.println("hello");
}
default void two(){
hello();
}
}
class four implements one{
public void sing(){
System.out.println("Singing");
};
}
abstract class Shape{
public void meth1(int a){
System.out.println("Hello world " + a);
}
public abstract void meth2();
}
class Rhombus extends Shape{
@Override
public void meth1(int a){
System.out.println("Bye world!");
}
public void meth2(){
System.out.println("Rohan Kumar");
}
public void meth3(){
System.out.println("Helooooo jeeeeeeeeee");
}
}
/* class Animal1{
public Animal1(){
System.out.println("I am a constructor of Base class");
}
public Animal1(String s){
System.out.println("I am a constructor of Base class and " + s);
}
public void color(String color){
System.out.println("The color of animal is "+ color);
}
public void name(String name){
System.out.println("My name is " + name);
}
}
class dog2 extends Animal1{
public dog2(){
super("rohan");
System.out.println("I am a constructor of child class");
}
public void bark(){
System.out.println("barking");
}
public void breed(String breed){
System.out.println("Breed is " + breed);
}
}
*/
public class CWr_Monday {
public static void main(String[] args) {
//dog2 obj= new dog2();
Shape obj= new Rhombus();
obj.meth1(8);
String q= new java.lang.String("rohan");
// four obj = new four();
// obj.two();
}
}
Comments
Post a Comment