13
answers
0
watching
567
views
2 Oct 2018

(b) Consider the following classes: public class House - ي شما هر چند = = private String rooms; public House() String rooms - new String [31; rooms (0) - "living room"; rooms [1] - "kitchen"; rooms (2) - "bedroom"; = public void print RoomList () for (int i-0; i < rooms.length; i++) { System.out.println (rooms[1]); = ہم نوا شهيد - public class Block يا نو public static void main(String[args) له House myblouse - new House(); myHouse.print RoomList(); د ه د The program compiles, but when you run the program, you get the following exception: Exception in thread "main" java.lang.NullPointerException at House.print RoomList (House.java:12) at Block.main (Block.java:6) The point of the method printRoomList is to print all the Strings in the house to the screen. Why does it give the error and write the code to fix the error while successfully printing all the rooms to the screen?

For unlimited access to Homework Help, a Homework+ subscription is required.

Unlock all answers

Get 1 free homework help answer.
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Irving Heathcote
Irving HeathcoteLv2
5 Oct 2018
Already have an account? Log in

Related questions

Related Documents

Weekly leaderboard

Start filling in the gaps now
Log in