Skip to main content

Java Lectures with code Examples

Comments

  1. ITS REALLY HELPFUL MAANNNNN.........

    ReplyDelete
  2. KINDLY UPLOAD MORE ABOUT JAVA ITS SEEMS TO BE VERY SIMPLE EXPLAINATION

    ReplyDelete
  3. WWW.CPROGRAMMING.COM

    ReplyDelete

Post a Comment

Popular posts from this blog

Composition in Java with code examples

Composition  "Have a " Relationship  OR  "Must have" relationship                    between two or more classes. Container class contains component's class object For example a  Car is composed of engine and body. Where Car is a container class and both Engine and Body are components class.  Life Time Issue in Composition Life time of component objects depends on container class If Container object destroyed, component objects will be also destroyed Car Example  There is a composition relationship between car's body and engine. Car must have Engine and body If Car destroyed, both Engine and Body will be destroyed class  Engine {   Engine  () {    System.out.println ( "Engine created" ) ; }   void  start () {    System.out.println ( "Engine Start" ) ;   } } class  Body...

Life Time of Objects in Java with code Examples

Lifetime Concept in Java Programming Time between allocation and de-allocation of memory Life time depends on block i.e { }  life time starts when  declaration statement elaborated and expires at end of block   There is no delete keyword in java  Garbage collector is responsible for all deletes Java is free from dangling reference and garbage problem Why java does not support delete keyword? Java does not support delete keyword because there is a garbage collector in java This automatically runs and collects dangling or un-referenced objects.That is why there is no delete keyword in java like C++. Garbage collector can be explicitly like that System.gc();  When a life of object ends garbage collector runs automatically Example 1 { int a=5;// life Time start here a++; } //life time expire Example 2   Let Student is a class Student s;   // creating a reference of Student class    {Student t; //...

Aggregation in java with example codes

What is aggregation?   "Have a" or "May have" relationship  Aggregation is special type of association  Life time of Component object is independent from its  container object E.g A school has one student class  Student  { String name; Student  () { name= null ;  } Student  ( String n ) { name=n;  } void  setName ( String n ) { name=n; } String getName () {  return  name; } } class  School { Student  st; School  (  ) {  st= null ; } School  ( Student s ){ st=s; } void  studentName (){    System.out.println ( st.getName ()) ; } } class  Post { public static  void  main  ( String a []){ Student st= new  Student ( "Imran" ) ; School s=  new  School ( st ) ; s.studentName () ; } } Output Hello ...