This is an example of the use of abstract classes and methods in Java.
Overall, this program demonstrates how abstract classes can be used to define a set of methods that must be implemented by any concrete class that extends it, and how these concrete classes can have different implementations of the abstract methods.
//Example for Abstract Class in Java Programming abstract class Mobile { void VoiceCall() { System.out.println("You can Make Voice Call"); } abstract void camera(); abstract void touchDisplay(); } class samsung extends Mobile { @Override void camera() { System.out.println("16 Mega Pixel Camera"); } @Override void touchDisplay() { System.out.println("5.5 inch Display"); } } class Nokia extends Mobile { @Override void camera() { System.out.println("8 Mega Pixel Camera"); } @Override void touchDisplay() { System.out.println("5 inch Display"); } void fingerPrint() { System.out.println("Fast Finger Sensor.."); } } public class abstractDemo2 { public static void main(String args[]) { samsung M32 =new samsung(); M32.VoiceCall(); M32.touchDisplay(); M32.camera(); System.out.println("-------------------------"); Nokia N1= new Nokia(); N1.VoiceCall(); N1.camera(); N1.touchDisplay(); N1.fingerPrint(); } }
You can Make Voice Call 5.5 inch Display 16 Mega Pixel Camera ------------------------- You can Make Voice Call 8 Mega Pixel Camera 5 inch Display Fast Finger Sensor..To download raw file Click Here
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions