0
how can i trace letter by letter? please in this code:
String str = "My Name Is Nada"; for(int x=0 ; x<str.length() ; x++){ // statement for tracing letter by letter😓 }
10 ответов
+ 5
Maybe you can try something like that:
public void scroll(String text){
int delay = 50;
ActionListener action = new ActionListener(){
int counter = text.length();
@Override public void actionPerformed(ActionEvent event){
if(counter == 0){
timer.stop();
}else{
System.out.print(text.substring(text.length()-counter, ((text.length()-counter)+1)));
counter--;
}
}
};
timer = new Timer(delay, action);
timer.start();
}
+ 5
But that doesn't wait before printing a letter
+ 4
oh, my apologies then
+ 3
You can't within SoloLearn because it executes all the code until the end first before showing you the console.
Though you can by using a computer compiler such as Oracle
+ 1
i found something easier:
String str="My Name Is Nada";
for(int x=0 ; x<str.length() ; x++){
char c = str.charAt(x);
}
0
ues i know
0
yes*
0
i want the code only, im using net beans
0
its okay bro