Appium Android Multiple Test case, How does it work?

I am trying to Appium to automate a test case on my app.
I managed to run a simple script, but I do NOT understand the logic of of the multiple testcases running process like android life-cycle.
What is the cycle for a testcase?
Because When I run the code below it does not run in order as of, firstTest, secondTest, thirdTest…
How do we tell the testCase what to run first and in what order ? thanks

public class LoginTest {

AndroidDriver driver;

@BeforeClass
public void setUp() throws MalformedURLException{
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("device", "Android");
    capabilities.setCapability(CapabilityType.BROWSER_NAME, ""); //Name of mobile web browser to automate. Should be an empty string if automating an app instead.
    capabilities.setCapability(CapabilityType.VERSION, "5.0.2");
    capabilities.setCapability(CapabilityType.PLATFORM, "Android");
    capabilities.setCapability("app-package", "com.myapp"); //Replace with your app's package
    capabilities.setCapability("app-activity", ".myapp"); //Replace with app's Activity
    driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}

@Test
public void firstTest() throws InterruptedException
{

	List<WebElement> textFieldsList = driver.findElements(By.className("android.widget.EditText")); 
	int size = textFieldsList.size();
	textFieldsList.get(0).sendKeys("[email protected]");
	textFieldsList.get(1).sendKeys("12345");
	Thread.sleep(1000);
	

	WebElement btnLogin=driver.findElement(By.name("Login"));
	String login = btnLogin.getText();
	Assert.assertTrue(login.contains("Login"));
	System.out.println(login);
	btnLogin.click();
	Thread.sleep(1000);
	
}

@Test
public void secondTest() throws InterruptedException {
	WebElement btnHome=driver.findElement(By.name("Home"));
	String login_1 = btnHome.getText();
	Assert.assertTrue(login_1.contains("Home"));
	System.out.println(login_1);
	btnHome.click();
	Thread.sleep(1000);
}
@Test
public void thirdTest() throws InterruptedException {
	WebElement btnSecond=driver.findElement(By.name("Second"));
	String login_2 = btnSecond.getText();
	Assert.assertTrue(login_2.contains("Second"));
	System.out.println(login_2);
	btnSecond.click();
	Thread.sleep(1000);
}

Thank you

Is this a TestNg question or JUnit? Either way you may want to look at the documentation of the tool you are using, I think in TestNg you can set a priority on each test or a dependency to do what you want. Not sure about JUnit.

If this is TestNG, you can use the “dependsOnMethods” option for @Test annotations to specify a dependency between test methods in the same class.

Why does the set of instructions have to be in separate methods? If whatever happens in the second test method depend on what occurs in the first test method, why not combine the two methods into one method?