JavaRush /Courses /New Java Syntax /Practice with static methods

Practice with static methods

New Java Syntax
Level 11, Lesson 4
Available

"Hi, Amigo. Here are some interesting tasks involving static methods:"

11
Task
New Java Syntax, level 11, lesson 4
Locked
Class counter
Class counter
11
Task
New Java Syntax, level 11, lesson 4
Locked
Static methods: int getCatCount() and setCatCount(int)
Static methods: int getCatCount() and setCatCount(int)
11
Task
New Java Syntax, level 11, lesson 4
Locked
StringHelper class
StringHelper class
11
Task
New Java Syntax, level 11, lesson 4
Locked
Controlling body weight
Controlling body weight
11
Task
New Java Syntax, level 11, lesson 4
Locked
ConsoleReader class
ConsoleReader class
11
Task
New Java Syntax, level 11, lesson 4
Locked
Calculator
Calculator
11
Task
New Java Syntax, level 11, lesson 4
Locked
Distance between two points
Distance between two points
Comments (2)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
YaharpY Level 14
15 December 2023
Task#5: Instead of duplicating the code to create a BufferedReader in each method, we should have created a private method to handle the common logic, but no... didn't compile. Why?
28 December 2023
It'll compile only if you have declared static parameter, cause static methods can't refer to non-static params

    private static Scanner s = new Scanner(System.in);