title: Access Try-Catch block's code in another class
body: <p>May be it could be silly,but I want to clear my the technical understanding of this code: </p>
  
  <pre><code>import netscape.*;//ldap jar
  public class A {
  
      public void method() {
          ...
  
          try {
              //code is written here.
               LDAPSearchResults lsr = ldi.search(LDAPConnectionInfo.MY_SEARCHBASE,LDAPConnectionInfo.MY_SCOPE,LDAPConnectionInfo.MY_FILTER,null,false);
               while(lsr.hasMoreElements()){
               LDAPEntry findEntry = (LDAPEntry)lsr.nextElement();
  
          } catch(...) { 
          } 
      } 
  }
  </code></pre>
  
  <p>Now I call another class</p>
  
  <pre><code>public class B {
      A a = new A();
      //here I want to use attributeName 
  }
  </code></pre>
  
  <ul>
  <li>How could I access A class's member(in try block) in B class.</li>
  <li>Any way to handle try block code for reuse in another class.</li>
  <li>How could I handle all those exception in another class.</li>
  </ul>
  
  <p>Any modification should I need... </p>
  
  <p>Calling method of Object type.</p>
  
  <pre><code>public class C{
  private String attributeName;
  
     public String getAttributeName() {
         return attributeName;
     }
  
  public Object method(){
  attributeName=lAttribute.getName(); 
  }
  }
  </code></pre>
  
  <ul>
  <li>How could print this Object type method into String(in a jsp page)... any inputs</li>
  </ul>