0
class Rev
 {
  char a[];
  char i=3; 
    void str()
    {
     for(i='A';i<'D';i++)
      {
       a[i]='i';
       }
     }    
   void show()
    {
     for(int i='A';i<'D';i++)
     {
      System.out.print(a[i]);
      }
     }  
    Void reversStr()
    { 
     for(i='A';i<'D';i++)
     { 
      System.out.print(a[i]);
      }
     }
 }
class Revers
{
  public static void main(String[] args)
   {
    Rev a1=new Rev();
    a1.str();
    a1.show();
    a1.reversStr();
   }
 }
3
Contributors
4
Replies
5
Views
10 Years
Discussion Span
Last Post by iamthwee
0

thanks i have slove my problem & my program is compiled.but on run that i have message "Exception in thread "main" java.lang.NullPointer Exception"

0
  1. class Rev
  2. {
  3. char a[];
  4. char i=3;
  5. void str()
  6. {
  7. for(i='A';i<'D';i++)
  8. {
  9. a='i';
  10. }
  11. }
  12. void show()
  13. {
  14. for(int i='A';i<'D';i++)
  15. {
  16. System.out.print(a);
  17. }
  18. }
  19. void reversStr()
  20. {
  21. for(i='A';i<'D';i++)
  22. {
  23. System.out.print(a);
  24. }
  25. }
  26. }
  27. class Revers
  28. {
  29. public static void main(String[] args)
  30. {
  31. Rev a1=new Rev();
  32. a1.str();
  33. a1.show();
  34. a1.reversStr();
  35. }
  36. }
  37. plz run and solve the problem
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.