by Dinesh Thakur Category: Classes

When values of built in types are passed as arguments to a function. It is known as Call by value. The changes made to formal parameters in the called function are not reflected in the actual arguments class.

 
by Dinesh Thakur Category: Classes

Compile Time Polymorphism in Java is when you have the several methods with same name and different parameters and compiler has to decide how to select which method has to run based on the arguments hence the name Compile time polymorphism or method overloading.

 
by Dinesh Thakur Category: Classes

Wrapper Classes:-  We know that Vectors can’t handle Primitives data types like int, float ,char, long So that Primitives data type may be Converted into object data types by using wrapper classes those are contained in java.lang packages The Various Wrapper Classes are :-



 
by Dinesh Thakur Category: Classes

Abstraction focuses on the outside view of an object (i.e. the interface) Encapsulation (information hiding) prevents clients from seeing it’s inside view, where the behavior of the abstraction is implemented.



 
by Dinesh Thakur Category: Classes

When multiple methods in the same class have the same name but differ in the number or types of parameters, it is known as Method Overloading. When an overloaded method is invoked, it is the responsibility of the compiler to select the appropriate overloaded method based on the number of argument(s) passed and if the numbers of argument(s) are same then depending upon the type of argument(s) passed to the method. Thus, the key to method overloading is a method's parameter list. A method's return type is not enough to distinguish between two overloaded methods. If the compiler detects two methods declarations with the same name and parameter list but different return types then it will generate an error.

 
by Dinesh Thakur Category: Classes

Main difference is methods of a Java interface are implicitly abstract and cannot have implementations. A Java abstract class can have instance methods that implements a default behavior.

 
by Dinesh Thakur Category: Classes

In this example, we compute the electricity bill of a particular customer. The class ElectricityBil1 contains field customerNo, name and units. It also contains methods setData () show () and billcalculate ().The statement,

 
by Dinesh Thakur Category: Classes

In java, base class reference can be assigned objects of sub class. When methods of sub class object are called through base class’s reference.



 
by Dinesh Thakur Category: Classes

In a class hierarchy, when a method in a subclass has the same name and type signature as a method in its superclass, then the method in the subclass is said to override the method in the superclass.

 
by Dinesh Thakur Category: Classes

We saw that a class had only one constructor with either zero, one or more parameters. The constructor is key for object initialization. The mechanism of constructor is made considerable more powerful by combining with the feature of overloading. Constructor can be overloaded in exactly the same way as you can overload methods.

 

Page 1 of 6

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content







Popular Article