You can just add the whitespace manually:
System.out.print(First + “ “ + Last);
Or maybe print it in different lines using “\n” :
System.out.print(First + “\n” + Last);
As for declaring your variables, it is best practice to declare them right after the class when possible:
class Lab2{
String First;
String Last;
int charCount;
public static void main(String[] args){
//code
}
}
Though you can also declare it inside the method in this case.
To get the amount of characters you must initialize the variable that will store it after getting the input from the scanner so your code should look something like this:
import java.util.Scanner;
class Lab2
{
String First;
String Last;
int charCount;
public static void main(String[] args) //header of the main method
{
Scanner in = new Scanner(System.in);
System.out.println("Enter you First name");
First = in.nextLine();
System.out.println("Enter you Last name");
Last = in.nextLine();
System.out.println((First) + (Last));
charCount = First.length() + Last.length();
System.out.println(“Total number of characters = “ + charCount);
}
}
If you are working with bigger strings that may have whitespace or input with leading/trailing spaces, there are a lot of useful methods like String.trim() and String.strip() you can find more reference here:
https://www.geeksforgeeks.org/java-string-trim-method-example/
https://howtodoinjava.com/java11/strip-remove-white-spaces/