1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
White raven [17]
3 years ago
15

Given public class Fishing { byte b1 = 4; int i1 = 123456; long L1 = (long) i1; //Line A short s2 = (short) i1; //Line B byte b2

= (byte) i1; //Line C int i2 = (int)123.456; //Line D byte b3 = b1 + 7; //Line E } Which lines WILL NOT compile? (Choose all that apply)
Computers and Technology
1 answer:
Aleksandr [31]3 years ago
5 0

Answer:

Line E.

Explanation:

The  given program is as follows:

public class Fishing {

   byte b1 = 4; int i1 = 123456; long L1 = (long) i1;   //Line A

   short s2 = (short) i1;     //Line B

   byte b2 = (byte) i1;     //Line C

   int i2 = (int)123.456;    //Line D

   byte b3 = b1 + 7;     //Line E

   }

In the above code Line E will not compile and give following compilation error:

error: incompatible types: possible lossy conversion from int to byte

This error is coming because in Java b1 + 7 will be interpreted as int variable expression. Therefore in order to make code of Line E work the expression should be type casted as byte.  

The correct code will be as follows:

public class Fishing {

   byte b1 = 4; int i1 = 123456; long L1 = (long) i1;   //Line A

   short s2 = (short) i1;     //Line B

   byte b2 = (byte) i1;     //Line C

   int i2 = (int)123.456;    //Line D

   byte b3 = (byte)(b1 + 7);     //Line E

   }

You might be interested in
Evaluate if the following function is a good candidate to be placed in a library. Why or why not?
Anastaziya [24]

Answer:

No, this would not be a good candidate because it can't be used in creating new programs.

Explanation:

^

8 0
2 years ago
Read 2 more answers
Identify the correct sequence of steps to change the font from Verdana to Arial.
Luden [163]
Go to your text and scroll until you find your preferred text
3 0
2 years ago
5 of 10
DaniilM [7]

Answer:

what

Explanation:

3 0
2 years ago
Fire stick optimizing system storage and applications
vivado [14]

Answer:

IN MY PROFILE

Explanation:

I HAVE AWNSERED THIS QUESTION THROUGHOUT MY BEING HERE PLEASE DO NOT BE AFRAID TO CLICK ON MY PROFILE AND FIND THE ANSWER

5 0
2 years ago
What is one effective way for employees to keep their skill-sets current
natta225 [31]
Is it a multiple choice answer? if so would like to see the answers as there are TONS of effective ways and if i list one it may not be in that list you have if its multiple choice.
3 0
2 years ago
Other questions:
  • Describe how using active listening at work can help you be a better employee.
    15·1 answer
  • What happens if you move unencrypted files into an encrypted folder?
    5·1 answer
  • What is the maximum upload speed you can get on an isdl internet connection?
    9·1 answer
  • What do you understand by structured programmingapproach? Also Discuss about bottom up and top down approach.
    8·1 answer
  • True or False? PPOs differ from HMOs because they do not accept capitation risk and enrollees who are willing to pay higher cost
    10·1 answer
  • What are the purposes of a good web page design?
    9·2 answers
  • Favorite color should it be stored why?or why not?<br>​
    6·1 answer
  • The use of a concept or product from one technology to solve a problem in an unrelated one
    11·1 answer
  • 1.a computer can create an output based on the input of the user.
    13·1 answer
  • I am a non-volatile type of built-in memory. I store my contents long-term. My job is to store critical programs that the comput
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!