Coders4fun Quiz #4
Categories: Quiz
Tags:
Main.java
public class Main {
public static void main(String[] args) {
System.out.print(Quiz.GetMagicNumber());
}
}
Quiz.java
public class Quiz {
static int magicNumber = 3;
public static int GetMagicNumber()
{
return magicNumber;
}
}
What we need to add in Quiz class to print 5 instead of 3?
Se sei interessato a questo post, potresti anche provare a leggere:
- No related posts
14 May 2008 dzamir
return 5; before return magicNumber;
UsandoOf course you can’t add nothing into the GetMagicNumber() method… -_-”
UsandoWe need to add a static initializer block to the class Quiz like this :
static {
UsandomagicNumber = 5;
}
@Petar Petrov:
UsandoCongratulations!
@Petar Petrov:
UsandoYou won a link in the blogroll