java - Variable might not have been initialized -


here am, thinking know java, , error variable 'storage' might not have been initialized. here code:

public class robbleset {     private final set<robble> storage; // error occurs here      public robbleset() {         storage = new hashset<robble>();     }      public addrobble(robble r) {         storage.add(r); // error occurs here     } } 

storage initialized in constructor. gives?

one problem you're not declaring return type addrobble; need change this:

    public addrobble(robble r) { 

to this:

    public void addrobble(robble r) { 

i suspect the problem — compiler thinks addrobble misnamed constructor, complaining fails initialize storage — if turns out it's not the problem, it's a problem.


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -