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 8693295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:31:08+00:00 2026-06-13T00:31:08+00:00

I’m calling various methods and the parameters Integer values are all defaulting to int,

  • 0

I’m calling various methods and the parameters Integer values are all defaulting to int, even values such as 1 or 0, is there anything I should be doing to solve this, other than type casting? Here’s an example of the code

public class Launch {
    public static void main(String[] args) {
        CoordinateHandler handler = new Handler();
        short x = 3901;
        short y = 5921;
        byte h = 2;
        handler.toCoordinates(x, y, h, "modern");
    }
}
public class CoordinateHandler extends CoordinateMain {
    public void toCoordinates(short absX, short absY, byte height, String type) {
        if (type.equals("modern")) {
            super.toCoordinates(absX, absY, height);
        } else {
            coordinateUpdateEvent(absX, absY, height, type);
        }
    }
}

I would get a compile error saying possible loss of precision on the lines of short x, short y, and byte h, and I would also get a compile error saying toCoordinates(int, int, int, String) can not be applied to toCoordinates(short, short, byte, String)

  • 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-13T00:31:09+00:00Added an answer on June 13, 2026 at 12:31 am

    It is not true that these lines

    short x = 3901;
    short y = 5921;
    byte h = 2;
    

    result in any compiler error; same goes for the subsequent method call. This is completely legal and correct Java. You are probably not showing the literal code that causes these problems for you, such as assigning from a variable or parameter and not from literal value, which is automatically cast into the type of the LHS.

    If you are indeed assigning from an int parameter, then the compiler is quite right: your assignment really may result in overflow.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I know there's a lot of other questions out there that deal with this
Seemingly simple, but I cannot find anything relevant on the web. What is the
I need to clean up various Word 'smart' characters in user input, including but
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.