Jim gross

Greenhorn
+ Follow
since Sep 24, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jim gross

Hi,
How do I write a recursive method:
reverse(Node first,Node last)
22 years ago
But I still don't know how to write a test class.
How do I start?
22 years ago
Hi Mr. Ernest,
Thank you for answering my question.
I forgot to send the rest of the code. Here they are.
public class List
{

private int element;
private List next;
public List()
{

element = 0;
next = null;
}
public List(int elem, List nextElem)
{
element = elem;
next = nextElem;
}
public void setElem(int someElement)
{
element = someElement;
}
public void setNext(List newNext)
{
next = newNext;
}
public int getElem()
{
return element;
}
public List getNext()
{
return next;
}
}
public class io
{
public io()
{
}

static String readString()
{ int ch;
String r = "";
boolean done = false;
while (!done)
{ try
{ ch = System.in.read();
if (ch < 0 | | (char)ch == '\n')
done = true;
else if ((char)ch != '\r')
r = r + (char) ch;
}
catch(java.io.IOException e)
{ done = true;
}
}
return r;
}


static void printPrompt(String prompt)
{ System.out.print(prompt + " ");
System.out.flush();
}


static int readInt(String prompt)
{ while(true)
{ printPrompt(prompt);
try
{ return Integer.valueOf
(readString().trim()).intValue();
} catch(NumberFormatException e)
{ System.out.println
("Not an integer. Please try again!");
}
}
}

static void error(String err)
{
throw new Error(err);
}

}
22 years ago
Hi,
How do I write a Test class for class LinkedList?

[This message has been edited by Cindy Glass (edited September 24, 2001).]
22 years ago