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]
2 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]2 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
A network administrator manages a network with 75 servers. At least twenty of those servers are approaching end of life but the
Gekata [30.6K]

Answer:

Virtual servers

Explanation:

4 0
3 years ago
I am trying to test out the software Classroom relay and I am just ask if there is any way kids can stop Classroom relay form se
Ratling [72]

Answer:

just don't share your screen in the class or if your a teacher just call them out

Explanation:

8 0
2 years ago
Read 2 more answers
Write a Python program that uses function(s) for writing to and reading from a file:
swat32

import random

def random_number_file_writer(nums):

   f = open("random.txt", "w")

   i = 0

   while i < nums:

       f.write(str(random.randint(1,500))+"\n")

       i += 1

   f.close()

def random_number_file_reader():

   f = open("random.txt", "r")

   total = 0

   count = 0

   for x in f.readlines():

       total += int(x)

       count += 1

   print("The total of the numbers is "+str(total))

   print("The number of random numbers read from the file is "+str(count))

def main():

   random_number_file_writer(int(input("How many random numbers do you want to generate? ")))

   random_number_file_reader()

main()

I hope this helps!

6 0
3 years ago
A DSS8440 server is equipped with one power supply that is failing and requires replacement. What is the correct sequence of ste
Alisiya [41]

Answer:

ICICI oxidized sicken o'clock o'clock succinct

6 0
2 years ago
The two outputs of a digital controller for an automatic drip coffee maker are for the time
victus00 [196]
The answer is (d.) display and pilot light

An automatic drip coffee maker displays two output from the digital controller; the time and the light or output signal. According to the US Patents publication, an automatic drip coffee maker includes a timer circuit. It's to provide pre-selected time for the activation and deactivation of the coffee maker.
7 0
2 years ago
Other questions:
  • In this problem we consider sending real-time voice from Host A to Host B over a packet-switched network (VoIP). Host A converts
    12·1 answer
  • In Java, a char variable is capable of storing any Unicode character. Write a statement that assigns the Greek letter ^ to a cha
    7·1 answer
  • 10 points (sorry it won’t let me do more points)
    10·1 answer
  • What are the characteristics of the Global Address List? Check all that apply.
    13·1 answer
  • Where is an ideal location to build a ground based observatory?
    10·1 answer
  • Ontext clues can be used to determine the _____ of an unfamiliar word
    11·1 answer
  • For each policy statement, select the best control to ensure Ken 7 Windows Limited fulfills the stated requirements and also pro
    6·1 answer
  • What is the cpu used for
    6·1 answer
  • Write a short essay on the importance of information and communication technology (ICT) in the AFN industry. Add suitable exampl
    11·1 answer
  • Another way to create a new presentation is from the Home tab
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!