by Dinesh Thakur Category: Classes



           class addr
                   int qt;
                  float pr;
                  void addition(stockadd  m, stockadd n)
                         System.out.println("Total quantity is :"+qt);
                         System.out.println("Total price is:"+pr);
                        class stockadd
                               BufferedReader bf=new BufferedReader(new InputStreamReader(;
                               String h;
                               int qty;
                               float price;
                               throws IOException
                                         System.out.println("Enter Quantity  ");
                                         System.out.println("Enter price  ");
                                          void showdata()
                                                   System.out.println("Quantity :"+qty);
                                                   System.out.println("price  :"+price);
                                                    public static void main(String args[])throws IOException
                                                             System.out.println("Enter details of first stock : ");
                                                             stockadd u=new stockadd();
                                                             System.out.println("Enter details of second stock : ");
                                                             stockadd v=new stockadd();
                                                             System.out.println("The detail of first stock is :");
                                                             System.out.println("The details of second stock is :");
                                                             System.out.println("The details of stock after addition is:");
                                                             addr w=new addr();

Adding the Contents of Two objects by passing objects as parameter.

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