Solved

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

Posted on 2006-11-28
3
826 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
The viewer will learn how to dynamically set the form action using jQuery.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

626 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