If you don’t want to use an array, then you could use something like this:
import processing.serial.*;
Serial myPort;
int counter = 0;
String s1, s2;
void setup() {
myPort=new Serial(this, "COM3", 9600);
println("********* end of setup() *********");
}
void draw() {
String str = myPort.readStringUntil('\n');
if (str != null) {
if (counter == 0) {
s1 = str;
print("s1:", s1);
println("====== end of read",counter+1 + " ===========");
}
if (counter == 1) {
s2 = str;
print("s2:", s2);
println("====== end of read",counter+1 + " ===========");
}
counter++;
}
}