This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Child class for Engineering | |
| //Super and super() keywords | |
| //=================================================================================== | |
| package college; | |
| import university.Engineering; | |
| public class Arts extends Engineering | |
| { | |
| public Arts() | |
| { | |
| this(60); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface Entertainment | |
| { | |
| public void serial(); | |
| public void comedy(); | |
| public void movie(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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) | |
| { |
OlderNewer