Sunday, 13 December 2015

Java Lab@home 6

1.Write a program to display the number of objects created for a class.

.Ans




2.Take an existing application and refactor the code to implement the data access object (DAO) design pattern.


Ans. CLICK HERE


3.Create an interface and implement that interface.


Ans.
        1 open the petcomposition project as the main project.
 a select file > open project.
 b browse t d:\labs\06-interfaces\practices.
 c select petcomposition and select the "open as main project chek box.
 d click the open project button.

2 expand the project diretories.

3 run the project. you should see output in the output window.

4 centralize all <name> functionality.
  a create a nameable interface (under the com.example package).
  b complete the nameable interface with setname and getname method signatures.
         public interface nameable {
        
         public void setname(string name);
    
        public string getname();
   }

c create a nameable class (under the com.example package).




4.Take an existing application and refactor it to make use of composition.


Ans.CLICK HERE


5.Use the Hash-map collection to count a list of part numbers.

Ans.CLICK HERE

2 comments: