About 165,000 results
Open links in new tab
  1. What is an instance variable in Java? - Stack Overflow

    Jan 7, 2021 · An instance variable is a variable that is a member of an instance of a class (i.e., associated with something created with a new), whereas a class variable is a member of the …

  2. java - Creating an instance using the class name and calling ...

    Is there a way to create an instance of a particular class given the class name (dynamic) and pass parameters to its constructor. Something like: Object object = …

  3. Using reflection in Java to create a new instance with the reference ...

    Dec 5, 2012 · All the examples I look at for reflection show creating a new instance of an unknown implementation, and casting that implementation to it's interface. The issue with this is that …

  4. Create instance of generic type in Java? - Stack Overflow

    Sep 17, 2008 · But you can always delegate creation to some other class that knows how to create an instance - it can be Class<E> or your custom code like this. interface Factory<E>{ E …

  5. How to declare a constant in Java? - Stack Overflow

    Oct 9, 2012 · You can use an enum type in Java 5 and onwards for the purpose you have described. It is type safe. A is an instance variable. (If it has the static modifier, then it …

  6. oop - What exactly is an instance in Java? - Stack Overflow

    Feb 26, 2011 · Reference is, in the Java context, a variable* - it is something pointing to an object/instance. For example, String s = null; - s is a reference, that currently references no …

  7. Java: How to have an ArrayList as instance variable of an object?

    I'm working on a class project to build a little Connect4 game in Java. My current thinking is to have a class of Columns that have as instance variable a few integers (index, max. length, …

  8. java - How to create a map instance variable - Stack Overflow

    Mar 12, 2014 · I've been trying to create a class that will model a scenario I've come up with. It will involve a map with string keys and values. I need to create an instance variable used to …

  9. java - How do I set default values for instance variables ... - Stack ...

    Apr 20, 2017 · You have two choices for setting the default value of an instance variable (sometimes called an "instance field"): Using an initializer on the declaration. Using an …

  10. java - Enum as instance variables - Stack Overflow

    Aug 4, 2012 · Before Java 5 the way to implement enums was to create a class with private constructor and public final fields of the same class initialised to specific values. Since Java 5, …

Refresh