there is a problem with java code

i need your help plz as soon as you can

import javax.swing.*;
	   import java.io.*;
	/**
	*Homework #1 CaesarCipher.java
	*program to encrypt and decrypt stuff
	*/
          
	public static void main(String[] args) {
			ceasar1 cc = new ceasar1();

	   public class ceasar1
	   {
	      public String dataencyptS, sInt;
	      public int offsetI;
	 
	      public void main(String [] args)	      {

	         dataencyptS=JOptionPane.showInputDialog("Input Data to encypt:");
	         sInt=JOptionPane.showInputDialog("Input the key offset:");
	 
	         offsetI = Integer.parseInt( sInt );
	      }
	 
	 
	      private void translate(int offsetI) {
	         char c;
	         while ((byte)(c = getNextChar()) != -1) {
	            if (Character.isLowerCase(c)) {
	               c = rotate(c, offsetI);                
	            }
	            System.out.print(c);
	         }
	      }
	 
	 
	      public char getNextChar() {
	         char ch = ' ';
	         try {
	 
	            ch =(char)dataencyptS.read();
	         } 
	            catch (IOException e) 
                    {
	               System.out.println("Exception reading character");
	            }
	         return ch;
	      }
	   // rotate: translate using rotation, version with table lookup
	      public char rotate(char c, int offsetI) { // c must be lowercase
	         String s = "abcdefghijklmnopqrstuvwxyz";
	 
	         int i = 0;
	         while (i < 26) {
	           // extra +26 below because key might be negative
	            if (c == s.charAt(i)) 
	               return s.charAt((i + offsetI + 26)%26);
	            i++;
	         }
	         return c;
	      }	 
	 
	 
	   }

write main method inside ceasar1 class

How?
Where I put it?

!!!

public class ceaser1
{
........
........


........

public static void main( String [] args )        // Write main Inside class ceaser1
{
     ceaser1 c = new Ceaser1();
}
.............

.............
.............
}

And give details of what you're trying to do...

your program has more errors ---

public char getNextChar() {
char ch = ' ';
try {

ch =(char)dataencyptS.read();     // error in read() method as there is no read() method
}
catch (IOException e)
{
System.out.println("Exception reading character");
}
return ch;
}

thank u but i am trying to do caesar cipher by java program

encrypt and decrypt using caesar cipher

this is my question !

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.