static tag

19 questions


1 answers
135 views
0
What is the role of the keyword static in the class?

package hello;public class Hello { Clock clock = new Clock(); public static void main(String args[]) { clock.sayTime(); }}When there was a code like this Cannot access non-static field in static meth...


1 answers
61 views
0
What do you mean by using a static factory method instead of a constructor?

I was working on the Java program, and my friend told me to use the static factory method instead of the creator.I didn't tell you why, but I don't know what this means.


1 answers
111 views
0
How do I create a static method that returns the name of the class in Java?

public class MyClass { public static String getClassName() { String name = ???; // How can I return MyClass? return name; }}I want to create a static method that returns the name of the class like t...

2 years ago

1 answers
151 views
0
Why can't I refer to the non-static variable in the static method?

I didn't learn Java well from the beginning. So I don't really understand the idea of static.An error non-static variable cannot... occurs when trying to declare a variable and use it within the metho...


1 answers
132 views
0
How can I get resource content from static context?

I'd like to read the string in xml. I need a lot from the widget, so can I call getResource and get it without an activity object?


1 answers
97 views
0
Static class member in Python

Can I create a static member variable or function in the Python class? What grammar should I use?


1 answers
116 views
0
What is the lifetime of the static variable in the c++ function?

As far as I know, the static variable defined in the scope of the function is initialized only once and remains even after the function endsWhat is the exact lifetime?When exactly are the constructors...

2 years ago

1 answers
56 views
0
Can't I use static and abstaract together?

public abstract class AbstractDataInterface : Fragment, DataInterface{ public abstract void SetHandler(int dest, Handler handler); public abstract Handler GetHandler(int dest); public abstract int Sen...

2 years ago

1 answers
65 views
0
Static variable cannot be modified

Full code. package recursion;public class study09 { private static int N = 8; static int[] cols = new int[N]; static boolean queens(int level) { System.out.println (queens call / level = + level); ...

2 years ago
« - 2 -

© 2024 OneMinuteCode. All rights reserved.