Question: How to write code based on given tests in java. Like how do u know what to write so these tests pass. Break it down

How to write code based on given tests in java. Like how do u know what to write so these tests pass. Break it down on how to approach code writing when the tests are given. For example if these are the given tests, how to write/ implement the code to pass these tests. No Stringbuilder. eXPLAIN ME HOW TO WRite code based on these tests
public static void testGetString(){
System.out.println("
Testing getString");
String result ="";
int[] a0={};
int[] a1={2};
int[] a2={2,1,3,0};
int[] a3={2,1,3,2,3};
result = Lab1.getString(a0);
System.out.println("should be {}: "+ result);
result = Lab1.getString(a1);
System.out.println("should be {2}: "+ result);
result = Lab1.getString(a2);
System.out.println("should be {2,1,3,0}: "+ result);
result = Lab1.getString(a3);
System.out.println("should be {2,1,3,2,3}: "+ result);
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!