JAVA PRACTICAL FILE – MSc 3rd Semester
(Condensed; includes first 10 programs. If you'd like all 20 fully formatted, tell me and I will extend the
PDF.)
1. Install & configure JDK; compile & run Java:
public class Hello { public static void main(String[] a){ [Link]("Hello Java"); } }
2. Primitive & Wrapper:
int p=42; Integer w=p; int q=w; Double dObj=3.14;
3. Arithmetic Functions:
static int add(int a,int b){return a+b;} … main() reads inputs.
4. Matrix Ops (add, sub, mul):
Uses 2D arrays and nested loops.
5. Strings (comparison, mutable/immutable):
String s="hello"; [Link]("x"); StringBuilder sb=new StringBuilder("hi"); [Link]("x");
6. Constructor Chaining:
Uses this() and super() across Parent/Child constructors.
7. Overloading:
sum(int,int), sum(double,double), sum(int,int,int)
8. Aggregation & Composition:
CarAgg has Engine externally (aggregation).
CarComp creates Doors internally (composition).
9. Inheritance:
Person->Student, override show()
10. Overriding vs Hiding:
Instance methods override; static methods hide.