Solved

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

Posted on 2006-11-28
3
808 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

776 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