Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2006-11-28
3
Medium Priority
?
831 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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses

721 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