static tag

19 questions


1 answers
145 views
0
Why doesn't Java allow static method override?

Why can't I override the static method in Java?If possible, show me an example of how to do it.


1 answers
71 views
0
To set a static variable within a function

In C, static was specified in the function like the code belowHow do I declare static in a function with Python?void foo(){ static int counter = 0; counter++; printf(counter is %d\n, counter);}

2 years ago

1 answers
70 views
0
What does static block mean in Java?

static { ...}I saw this code. I don't know what this is at all, and it doesn't make errors and compiles well.What does the 'static' block mean?

2 years ago

1 answers
180 views
0
I would like to ask you about the Cstatic function

I have a question about the static function, not the c++ static method.I know the static variable, but what is the static function?Also, if you define void myfunc() in another c file and include this ...

2 years ago

1 answers
97 views
0
Why do you use the static function of C?

Question about the C static function says there's a static functionI wonder why you make a function only available in the same file.

2 years ago

1 answers
141 views
0
Accessing public static variables inside a class declared private

private class Example { public static final PI = 3.14; ...}If there is a code configuration like above, is PI accessible from the outside?Classers restrict access from the outside to private, but PI a...

2 years ago

1 answers
152 views
0
Question about java array constants.

When declaring an array final int[] arr = {1, 2, 3, 4, 5};If I do this, I can't just change the address value of the arr, but I can change the arrangement contents, right?I want to constant the array ...

2 years ago

1 answers
98 views
0
How to initialize private static members

How do I initialize private static member?There is an error in the way I did itld: 1 duplicate symbol for architecture x86_64clang: error: linker command failed with exit code 1 (use -v to see invocat...


1 answers
141 views
0
Initialize static const string in class

Isn't it okay to initialize the static const member variable within the class?The error message says to initialize out of line.I don't want to use #define but what should I do Static data member of ty...

2 years ago

1 answers
119 views
0
Static initialization block

Until now, I understood that static initialization block is used when it is impossible to set the value of the static field with one line.But I don't know why I need a special block for that work. For...

- 1 - »

© 2024 OneMinuteCode. All rights reserved.