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
What is the answer and why?
Tanya [424]

Answer:

this.a = a;

Explanation:

YourClass inherits the variable a, so it is available for declaration.

Also, all other replies are meaningless.

8 0
4 years ago
Consider a system consisting of processes P1 , P2 , ..., Pn , each of which has a unique priority number. Write a monitor that a
adelina 88 [10]

Answer:

See explaination

Explanation:

The code

type printer = monitor

var P: array[0…2] of boolean;

X: condition;

procedure acquire (id: integer, printer-id: integer);

begin

if P[0] and P[1] and P[2] then X.wait(id)

if not P[0] then printer-id := 0;

else if not P[1] then printer-id := 1;

else printer-id := 2;

P[printer-id]:=true;

end;

procedure release (printer-id: integer)

begin

P[printer-id]:=false;

X.signal;

end;

begin

P[0] := P[1] := P[2] := false;

end ;

Note:

Monitors are implemented by using queues to keep track of the processes attempting to become active int he monitor. To be active, a monitor must obtain a lock to allow it to execute the monitor code. Processes that are blocked are put in a queue of processes waiting for an unblocking event to occur.

7 0
3 years ago
Which HTML tag is used to add a paragraph to a web page?
NikAS [45]

Answer:

the HTML tag for the paragraph is <p>.

Explanation:

To insert the paragraph in the website, use the <p> tag to start the paragraph and to end the paragraph, use the closing paragraph tag that is </p>.

The paragraph tag is used inside the body tag. for example,

<html>

 <head></head>

 <body>

   <p>this is a paragraph

   </p>

 </body>

</html>

4 0
3 years ago
Write a java code to print Multiplication Table Till 20
Ket [755]

Explanation:

Do not disturb me everyone

8 0
3 years ago
Read 2 more answers
Identify 5 products/services needed by the people in our current situation.<br>​
makvit [3.9K]

Answers with Explanations:

5 Products/Services Needed by People These Days.

1. Face mask/Surgical mask - The use of face mask is considered a<em> common sense.</em> Most countries mandate people to wear this every time they go out.

2. Food Delivery service - To prevent contracting corona virus, most people prefer to have their food delivered than to dine out. This increases the demand for the food delivery service.

3. Alcohol - It has become an important habit recently to disinfect hands and other things. This is also being advertised on TV, thus many people carry it along with them.

4. Infrared Forehead Thermometer - Many establishments use this in order to quickly check the temperature of people entering.

5. Internet service - The increase use of this service is due to online learning and remote-working situations.

3 0
3 years ago
Other questions:
  • Briefly outline what LCD screen contain on the inside and why shouldn't it be opened by someone who is not qualified to work wit
    13·2 answers
  • Laura is confused with the spelling of the word pronunciation. She types the word pronunciation. Which feature of the auto corre
    8·2 answers
  • Which field in a Transmission Control Protocol (TCP) header provides the next<br> expected segment?
    5·1 answer
  • What major criteria must a product or process meet in order to be considered emerging technology?
    6·1 answer
  • What are digital forensic techniques? A. Identifying, extracting, and evaluating evidence obtained from digital media such as co
    11·1 answer
  • A ______________ is a way of taking a screenshot or a picture of your computer screen. ​
    14·1 answer
  • What are the classifications of computer
    9·1 answer
  • What is the purpose of a Post Mortem Review? (5 points)
    5·1 answer
  • Name various input and output devices used with computers.
    7·1 answer
  • Why is it important for the scrum master to help the team focus on daily and iteration goals\
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!