Feng Shui and statics

  • 2
  • Locked
An expert in feng-shui programming looked at the code for a few seconds, lifted one eyebrow, and nodded while solemnly saying: "I found an error in the location of the modifiers in this code. You need to rearrange one static modifier. Then everything will be feng shui. The example will compile. Harmony will be restored".
You can't complete this task, because you're not signed in.
Comments (8)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
EugeneEmory
Level 8 , San Antonio, United States
12 March 2021, 14:11
Why would you make one variable static and not the other?
Andrei
Level 41
13 October 2020, 11:56
Hello, I have a question here, I will try to explain without giving to much away, if someone can help please! When you move the static to the correct place, in the other place, shouldn't you use "this." seeing it has become a static variable that is used somewhere else? Thank you!
arvindsid
Level 10 , Chennai, India
22 September 2018, 11:27
there are only 2 static modifiers and the code compiled but still I don't understand what the issue is
package com.codegym.task.task06.task0615;

/*
Feng Shui and statics

*/

public class Solution {

    public static int A = 5;
    public static int B = 2;
    public int C = A * B;

    public static void main(String[] args) {
        A = 15;
    }
}
Roman
Level 41
24 September 2018, 05:17
If you need help, something isn't right in your code, the server won't accept your solution (even if you are 100% sure that it is correct). Describe your question/issue in the HELP section at codegym.cc/help. ps there are 3 static modifiers in your code.
Michael
Level 10 , Dresden, Germany
23 January 2020, 20:55
Just remove the static for the instance variable 'B'
An Gelo
Level 18 , Cebu, Philippines
16 August 2018, 15:10
Hi im confused on this part what do you mean by move. i tried to change int A to a Static variable but it can't cause the static c is using B and B is not Static.
Roman
Level 41
17 August 2018, 05:30
"Move" means delete static modifier in one place of code and write it in another place.
An Gelo
Level 18 , Cebu, Philippines
17 August 2018, 09:37
ohhh thanks bro