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

  • Home
  • SEARCH
  • 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 6762891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:24:45+00:00 2026-05-26T14:24:45+00:00

Here is the code: import java.util.*; public class dayName { public static void main(String[]

  • 0

Here is the code:

    import java.util.*;

public class dayName {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Please enter the number to find out what day of the week it represents:");
        int number = in.nextInt();
        weekNumber(number);
    }

    public static String weekNumber(int number)
    {
        String dayNumber;
        switch (number)
        {
        case 1: dayNumber = "Monday"; break;
        case 2: dayNumber = "Tuesday"; break;
        case 3: dayNumber = "Wednesday"; break;
        case 4: dayNumber = "Thursday"; break;
        case 5: dayNumber = "Friday"; break;
        case 6: dayNumber = "Saturday"; break;
        case 7: dayNumber = "Sunday"; break;
        default: dayNumber = ""; break;
        }

        return dayNumber;
    }

}

My problem is that it compiles fine but when you ask it the number it doesn’t return anything, it should return the day string depending on the number you enter.

Please bear in mind I’m learning Java.

  • 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-05-26T14:24:45+00:00Added an answer on May 26, 2026 at 2:24 pm

    weekNumber() just returns the value but you don’t do anything with it.

    Change that line to:

    System.out.println(weekNumber(number));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my code: import java.util.Scanner; public class Arrays { public static void main(String[] args)
Here is my code: import java.util.*; public class Multiply { public static void main(String[]
Here is my code: import javax.swing.*; import java.awt.*; public class PanelModel { public static
Consider this code: import java.util.regex.*; public class Pattern3 { /** * @param args the
Here is my code: import java.io.*; import java.util.*; import javax.comm.*; public class SMS {
Wen I have this code: import java.util.Scanner; import java.util.Arrays; public class Ex02 { /**
Here is the code: import javax.swing.*; import java.awt.event.*; import java.awt.*; public class TestGrid {
Here I found this code: import java.awt.*; import javax.swing.*; public class FunWithPanels extends JFrame
Here is a simple piece of code: import java.io.*; public class Read { public
So, I'm getting stuck with this piece of code: import java.util.InputMismatchException; import java.util.Scanner; public

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.