Reputation: 765
I got this code:
public void main(){
}
public void first(){
System.out.println("first void");
}
public void second(){
System.out.println("second void");
}
public void third(){
System.out.println("third void");
}
Now I want to add a code to the main void that would skip to the third one for example. That means, that the console output will be:
third void
Upvotes: 2
Views: 182
Reputation: 3973
The following code will produce the desired output:
public void main(){
third();
}
public void first(){
System.out.println("first void");
}
public void second(){
System.out.println("second void");
}
public void third(){
System.out.println("third void");
}
Please note that it does not "skip" the first
and second
function, but simply does not call them. I'm not sure whether this makes a difference for you or not.
Upvotes: 5
Reputation: 27003
If you execute your code from your main method call it like
public void main(){
third();
}
Upvotes: 3