how to run only specific file
i added new file and it has main method and i want to run only that file. currently it is running only first added file which has main method
Hi !
Replit will run the Main
class and in this class the main
method will be called.
If you want to have two codes, you should create two repl
There is an other way but I don't think that it is a good practice (I do not know java very well)
You can call the main
method of BestTimeToBuyStock
class in the Main class
This not very clear so I made an example here
Main.java line 67
String empty[] = {}; BestTimeToBuyStock.main(empty);
Replit helper here !
If you found my answer helpful, you can upvote it :)
If my post answers the question, mark it as the answer with the check mark !
What do you mean by running not main method? or maybe:
public class Main { //main(paramater); OtherCode(); public static void main(String []args){ //code } public static void OtherCode(){ //code } }
You just call the function that you want, and comment out the functions that you don't want.
in console type in: javac BestTimeToBuyStock.java
and then java BestTimeToBuyStock