So I searched if someone before me wanted to know how a typing text works and found this here how-to-add-java-typing-text but the code from Vogel612 gives me errors on "Random.nextInt(40)..." and specialChars.contains...". Btw im a beginner so pls answer like you would answer a beginner xD.
Here is the code I have in my class:
import java.util.Random;
public class Buildingtext {
public static void main(String[] args) {
// TODO Auto-generated method stub
String text="bla zzz ´` asdasdasda y yyyx sdsy sddx";
for (char c : text.toCharArray()) {
// additional sleeping for special characters
if (specialChars.contains(c)) {
Thread.sleep(Random.nextInt(40) + 15);
}
System.out.print(c);
Thread.sleep(Random.nextInt(90) + 30);
}
}
}
The "specialChars" error says : specialChars cannot be resolved.
Both Random.nextInt()
errors say : cannot make a static reference to the non-static method nextInt(int)
from the type Random.
I really need help thanks guys D´:
Aucun commentaire:
Enregistrer un commentaire