You need help on this kind of material?
public class Test
{
public static void main(String[]args)
{
System.out.println("Welcome to java");
}
}
if not give me an example.
I created a class Alpha and wrote code for it. I now need to write a tester class (which i assume will be called AlphaTest) that will test the Alpha class by supplying a random number as the arguement to the constructor. In theory I understand what it is asking me but i am not sure how to create this test class.
~Will
class AlphaTester {
public static void main(String[] args) {
Alpha alpha = new Alpha();
alpha.method1();
System.out.println(alpha.method2());
}
}
Basically write code that tests if all methods work as per specifications.
If u want to test the constructor with one argument,
class Alpha{
public Alpha(int x) {
System.out.println("This is constructor with 1 arg");
}
}
class AlphaTester {
public static void main(String[] args) {
Alpha alpha = new Alpha(1);
}
}