Skip to main content

All Questions

Tagged with
1 vote
1 answer
309 views

Do inherited methods use the visibility, methods and attributes of the superclass or subclass?

What I assume is that an inherited method will, by standard, use the methods and attributes of the class whose object is used to execute that method. Here's an example for my question, it's from a ...
grecode97's user avatar
0 votes
1 answer
46 views

Calling JFrame from separate class

I am using Intellij IDEA 2017. I am learning how to use JFrames, and am trying to create a basic GUI. I am trying to create two JFrames in separate classes, and call them from the Main class. What I ...
Kirkland Burrill's user avatar
-2 votes
1 answer
58 views

In Java, what do you call a class with a private constructor or many private constructors? [closed]

What would it mean if a class had only private constructors? Can you name such a class?
Lorren112's user avatar
3 votes
3 answers
69 views

Method nonvisibility of same instanceof but differing class

I have something like the below: Item var; Depending on user input, it will be initialized as a different class: if (/*user input*/ == 1) { var = new Item(); } else { var = new Truck(); } ...
gator's user avatar
  • 3,513
-4 votes
1 answer
5k views

The final local variable "name" cannot be assigned, since it is defined in an enclosing type

I have this class: class Tester{ final String rigaFile=riga; final BufferedReader r=new BufferedReader(reader2); fr.getList().addListSelectionListener(new ListSelectionListener() { ...
Amedeo Tortora's user avatar
-6 votes
3 answers
175 views

Private class property visible

How is it possible that private itemset property is visible in a copy constructor? import java.util.List; import java.util.ArrayList; public class Itemset { private List<Integer> itemset =...
Sophie Sperner's user avatar
0 votes
3 answers
100 views

Java class design issue

Here is a class design: http://pastebin.com/1RSdmtXi If i put only A to class Expect I would like to see only A's getters and setters, or vica vera to B. If put in A and B, then all of getters and ...
Lespaulka001's user avatar
1 vote
5 answers
2k views

How to implement an interface on a protected java class

I was looking to implement an interface on a package-private java class, but I am having some difficulty achieving this. Below is an example. class Foo { String something(String str) { ...
andersra's user avatar
  • 1,135