Skip to main content

Posts

String In Java

2.7 Method Overloading & Method Overriding.

Method Overloading : Some operation with different parameters. Example : class Demo1 { void test(int arg) { - } void test(double arg) { - } void test(char arg) { - } } Example Program1 : class Demo1 { void test() { System.out.println("rnning no arg test() method"); } void test(int arg) { System.out.println("rnning int arg test() method"); System.out.println("arg value is"+arg); } void test(double arg) { System.out.println("rnning double arg test() method"); System.out.println("arg value is"+arg); } void test(int arg1, double arg2) { System.out.println("rnning int, double arg test() method"); System.out.println("arg1 value is"+arg1); System.out.println("arg2 value is"+arg2); } } class MainClass1 { public static void main(String args[]) { System.out.println("main method started"); Demo1 d1 = new Demo1(); d1.test(); d1.test(25); d1.test(4.6); d1.test(14, 7.2); System.out.println("program ended...

Latest posts

2.6 Composition.

2.5 Inheritance.

2.4 Constructor.

2.3 OOPS-Memory in Java.

2.2 Object/Instance of class.

2.1 Class in Java.

1.10 String in java.

1.9 Arrays in Java.

1.8 Loop || For Loop || While Loop in java.

1.7 Control Statement || Decesion Making || if & else statement || if else programming.