+ 1
getting no output
why i m getting no output for thi program. https://code.sololearn.com/c52E4X6KoufZ/?ref=app
2 Réponses
+ 5
your run() function does return à string, but you never tell to print it.
you could do :
system.out.println(Program.run());
+ 2
listen .Your method is Static and if you want to access your Static method then their is a technique.
which is
object of class.static method
here you can see in this program i have added
Program new().run() (program new() is your object of class and run is your method name)
so priniting these in System.out.println
public class Program
{
public static String run(){
return "hello";
}
public static void main(String[] args) {
//here i have used this technique...
System.out.println(new Program().run());
}
}