Skip to content

Instantly share code, notes, and snippets.

//Method Over Loading
//==================================================================================
package socialmedia;
public class Whatsapp
{
final String name = "Meta";
public static void main (String [] args)
{
Whatsapp member = new Whatsapp();
member.accountCreation("kumar",948278872,28);
//Method Over Riding
//==================================================================================
package socialmedia;
public class Facebook extends Whatsapp
{
String name = "Fb";
public static void main (String [] args)
{
Facebook fbuser1 = new Facebook();
System.out.println(fbuser1.name);
//Constructor overloading and super command parent class for Arts.java
//====================================================================
package university;
public class Engineering
{
public Engineering()
{
System.out.println("This is parent class zero Argument constructor");
}
public Engineering(int totalStudents)
@kumarrcpm
kumarrcpm / Arts.java
Last active January 10, 2022 15:16
Child class for Engineering ,Super and super() keywords
//Child class for Engineering
//Super and super() keywords
//===================================================================================
package college;
import university.Engineering;
public class Arts extends Engineering
{
public Arts()
{
this(60);
@kumarrcpm
kumarrcpm / RationShop.java
Last active January 10, 2022 14:49
Constructor OverLoading
//Constructor OverLoading
//===================================
public class RationShop
{
String name, pongalparisu;
int rice,sugar,oil;
public static void main(String [] args)
{
RationShop kumar = new RationShop("kumar","done",20,2,1);
RationShop ram = new RationShop("ram","notdone",10,2);
@kumarrcpm
kumarrcpm / Entertainment.java
Created January 18, 2022 14:00
Interface class
interface Entertainment
{
public void serial();
public void comedy();
public void movie();
}
@kumarrcpm
kumarrcpm / Sunnetwork.java
Created January 18, 2022 14:16
Interface child class
public class Sunnetwork implements Entertainment
{
public static void main(String [] args)
{
Sunnetwork sun = new Sunnetwork();
sun.serial();
sun.comedy();
sun.movie();
sun.news();
Entertainment md = new Sunnetwork();
@kumarrcpm
kumarrcpm / Adityatv.java
Created January 18, 2022 14:25
interface of entertainment with extends
public class Adityatv extends Sunnetwork implements Entertainment
{
public static void main (String [] args)
{
Adityatv aditya = new Adityatv();
aditya.serial();
aditya.comedy();
aditya.movie();
aditya.news();
}
@kumarrcpm
kumarrcpm / Nestedif.java
Created January 19, 2022 03:58
Nested if comparing three numbers
//Nested if comparing three numbers
public class Nestedif
{
public static void main(String [] args)
{
int a=5, b=10, c=15;
if(a>b)
{
if (a>c)
{
@kumarrcpm
kumarrcpm / Nestedif1.java
Created January 20, 2022 03:09
Nestedif Comparing four numbers
//Nested if comparing four numbers
public class Nestedif1
{
public static void main(String [] args)
{
int a=3, b=20, c=5, d=10;
if (a>b)
{
if (a>c)
{