Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8957789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:04:16+00:00 2026-06-15T15:04:16+00:00

The following code gives me compile-time errors: missing return value and missing return statement,

  • 0

The following code gives me compile-time errors: missing return value and missing return statement, what value would I return for this Void Type?

final SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
    @Override
    protected Void doInBackground() throws Exception {
        // some code
        if (something) {
            return;
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:04:17+00:00Added an answer on June 15, 2026 at 3:04 pm

    Void is not void, change it to void type if you don’t want to return anything.

    Void is a class, void is type.

    /**
     * The {@code Void} class is an uninstantiable placeholder class to hold a
     * reference to the {@code Class} object representing the Java keyword
     * void.
     *
     * @author  unascribed
     * @since   JDK1.1
     */
    

    If you want Void, then you need to add return statement at end.

    Example:

    protected Void doInBackground() throws Exception {
        // some code
        if (something) {
           return null;
        }
        return null;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When trying to compile my code i get the following errors every time. These
The following piece of code gives compile-time error in VS2010: Use of unassigned local
The following code gives digits whose name is shorter than their value. I can't
The following code gives seg fault and some time stalls/hangs and never works. for(i=0;i<360;i++)
the following code for some bizarre reason gives me a value for each row
I'm trying to compile the following piece of code: #include <stdio.h> #include <time.h> #include
This simple piece of code really gives me hard time, so could anyone be
I have the following code but can't compile it because I have a Type
The following code gives compile error with g++-4.7.0 but compiles fine with g++-4.6. #include
The following code when compiled give this error I cannot understand why this is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.