can someone help me add a another class in this code
i got this code in this site, but i need to have at least 2 class

Do you know how to define a class? You must if you have written any java programs.
Can you explain specifically what problem you are having adding a class?
What kind of class do you want? Inner or external? public or ?

I am really new to java

about defining a class i know a little...

here's the partial code i need to put into a class

public static String checkID(String acctNum, String pwd)//separating the part from the main program as a new function in the main function
	{
		String result = "error";//declaring the result as string
		// Strings a, b, and c contain the valid account numbers and passwords.
		// For each string, the account number is listed first, followed by
		// a space, followed by the password for the account, followed by a space,
		// followed by the current balance.
		String a = "44567-5 mypassword 520.36";//declaring string a which id equal 44567-5 mypassword 520.36 in this function
		String b = "12345-6 anotherpassword 48.20";//declaring string b which id equal 12345-6 anotherpassword 48.20 in this function
		String c = "54321-0 betterpassword 96.74";//declaring string c which id equal 54321-0 betterpassword 96.74 in this function
		String d=a.substring(0,7);//declaring string d in this function
		String e=a.substring(8,18);//declaring string e in this function
		String eres=a.substring(19);//declaring string eres in this function
		String f=b.substring(0,7);//declaring string f in this function
		String g=b.substring(8,23);//declaring string g in this function
		String gres=b.substring(24);//declaring string gres in this function
		String h=c.substring(0,7);//declaring string h in this function
		String i=c.substring(8,22);//declaring string i in this function
		String ires=c.substring(23);//declaring string ires in this function
		if(acctNum.equals(d) && pwd.equals(e))//checking for account number and password
		{
			result=eres;//gives commands for the if statement
		}

a account class

What is the problem with putting it in a class? The basics:

class AClass {
  // variables and methods here
} // end of class

Your single letter variable names will make it hard to understand what you code is doing if the code ever gets more than 30 lines long. Variables names should be selfdocumenting words that you can read and understand what the variable is used for.

Most of your comments are redundant. They say what the code does but not why. For example:
int ix = 10; // set the int ix to 10
vs
int iy = 20; // set iy to the max search length

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.