Solved

Class, struct, or interface method must have a return type

Posted on 2006-11-28
3
803 Views
Last Modified: 2008-01-09
Not sure why I get this error, here's the code:

    private List<sss.DataTier.sss1.sss2> categoryList = new List<sss.DataTier.sss1.sss2>();
    LoadSSSList();

    private void LoadSSSList()
    {
        categoryList = sss.DataTier.sss1.sss2.GetCategoryList(sss.DataTier.sss1.sss2.Values.version, VID);
    }
0
Comment
Question by:dba123
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
petiex earned 500 total points
ID: 18034018

    // this will give you a compiler error, because, as an interface, java.util.List cannot be    
    // instantiated.
    // instantiate something that implements List, like java.util.ArrayList
    //private List<sss.DataTier.sss1.sss2> categoryList = new List<sss.DataTier.sss1.sss2>();
    private List<sss.DataTier.sss1.sss2> categoryList = new java.util.ArrayList<sss.DataTier.sss1.sss2>();
    // this was causing the "must have return type" error. The compiler sees it as an invalid method  
    // declaration. It looks like what you want is to invoke the method declared below in an init block:
    // LoadSSSList();
   {
       LoadSSSList();
   }

    private void LoadSSSList()
    {
        categoryList = sss.DataTier.sss1.sss2.GetCategoryList(sss.DataTier.sss1.sss2.Values.version, VID);
    }
0
 
LVL 11

Expert Comment

by:petiex
ID: 18034071
I was assuming you meant java.util.List. If it's actually a concrete class like in java.awt.List, then never mind the first part, and forgive my presumption. ;)

The part about the init block should fix the "must have return type" problem in any case.
0
 
LVL 1

Author Comment

by:dba123
ID: 18063606
this is C#....but thanks, same concept.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Accessibility and Usability are two concepts that seem to be closely related.  But, too many people seem to have a distorted perception of them. During last five years, those two words have come to the day-to-day work of almost every web develope…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now