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();
   }
 }

The only thing I can see, at a quick glance is on line 19. Take a close look at that Line.

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"

  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
Member Avatar for iamthwee

What is the significance of i < 'D'?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.