Forums Register Login

URGENT

+Pie Number of slices to send: Send
Hi well I creating a program with two classes and one of those classes is a test class which test the other class that basically is an ADT of giant number of 100 digits. but I'm having a problem and I do not know what is it here is my code:
public class GiantNumber
{
private short[] digitsArray;
public GiantNumber(int value)
{
this();
int x = 99;
while (value !=0);
{
digitsArray[x] = (short) (value % 10);
value = value /10;
x--;
}
}
public GiantNumber ()
{
for (int j = 0; j < 100; j++)
{
digitsArray [j] = 0;
}
}
public void add(GiantNumber otherNumber)
{
int a = 0;
int b = 0;
for(int y = 99; y >= 0; y--)
{
this.digitsArray[y] += otherNumber.digitsArray[y] + a;
this.digitsArray[y] = (short) b;
b = this.digitsArray[y] % 10;
a = this.digitsArray[y] / 10;
}
}
public void substract(GiantNumber otherNumber1)
{
GiantNumber a = new GiantNumber(20);
GiantNumber b = new GiantNumber(15);
a.substract(b);
}
public void greater()
{
}
public boolean equals()
{
return true;
}
public String toString();
{
}
}
public class TestGiantNumber
{
public static void main(String[] args)
{
TestGiantNumber GiantNumber = new TestGiantNumber();
GiantNumber a = new GiantNumber(2);
GiantNumber b = new GiantNumber(2);
a.add(b);
}
public TestGiantNumber()
{
}
}
and when I run the program the error is:
java.lang.ClassFormatError: GiantNumber (Code attribute is absent in method that is not abstract or native)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
at TestGiantNumber.main(TestGiantNumber.java:20)
Exception in thread "main"
+Pie Number of slices to send: Send
I see that you have two public classes in your program.
public class GiantNumber
and
public class TestGiantNumber
Only one class per java source file can be "public"
+Pie Number of slices to send: Send
Jose,
After 21 posts you still didn't use code tags and you used the subject line of "URGENT" (in all upper case letters).

Do you know how many people will avoid your post because of these two things?
+Pie Number of slices to send: Send

[ February 05, 2004: Message edited by: Marilyn de Queiroz ]
I don't even know how to spell CIA. But this tiny ad does:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1712 times.
Similar Threads
what is the problem with this code
Showing Images in Splash Screen
forte for java
java BigNumber 2
FileNotFoundException
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 06:57:28.