+ 1
Why my code is not showing any output
Can anyone pls help me by telling me why my code is not working. https://sololearn.com/compiler-playground/cROVwNWi2jUv/?ref=app
5 Answers
+ 2
Have a look at the parameters of Java's main method.
https://www.javatpoint.com/java-main-method
It takes a string array.
Note that sololearn Java playground is not interactive; you cannot pass command line arguments.
+ 2
First, you need to change the following.
--public static void main(String[] args)--
String[] args is a command line argument, so the argument can only be passed at runtime. And this site, as far as I know, does not pass arguments at runtime. So you need to define a function or write variables directly.
Example:
public class Program
{
public static void main(String[] args) {
//Directly
String customerName="ABC";
System.out.println("Customer Name:" + customerName);
//call function
call("CDE",101);
}
public static void call(String customerName, int membershipCode){
System.out.println("Customer Name:" + customerName);
System.out.println("Membership code:" + membershipCode);
}
}
+ 1
Thank you
0
I don't understand pls say in simple way
0
I made a sample. You can input the customer name.
https://www.sololearn.com/en/compiler-playground/cb8lUiOPjEbA