+ 1
Should be a straight forward q,
Hi guys. I got the following code: public class JavaApplication3 { /** * @param args the command line arguments */ public static void main(String[] args) { int age = 22; int money = 800; if (age > 18) { if (money > 500) { System.out.println("Welcome"); } } // TODO code application logic here } static void dog(String[] args) { int andrew = 88; if(!(andrew > 31)) { System.out.println("too young"); } else { System.out.println("perfect"); } } } i got no errors on it but simply want it to run the 'dog' method which its completely ignoring. can you help? thanks!
3 Respostas
+ 14
public class JavaApplication3 {
public static void main(String[] args) {
int age = 22;
int money = 800;
if (age > 18) {
if (money > 500) {
System.out.println("Welcome");
}
}
dog();
}
static void dog() {
int andrew = 88;
if(!(andrew > 31)) {
System.out.println("too young");
} else {
System.out.println("perfect");
}
}
}
/*👉 the method dog (String args []) was not working as method call ie dog(a_String_array); in main method was missing*/
0
Thanks for this mate but I'd tried this, (putting 'dog();) in and instead I got this error:
actual and formal arguments list differ in length. therefore what I though I'd do instead of just 'dog()' was insert 'dog(String[] args) but still no luck...
all i want to do basically is for one string method to follow another....
0
Bo! dude i got it, missing the class. should be:
JavaApplication3.dog(args);
thanks