This topic contains a solution. Click here to go to the answer

Author Question: What exception type does the following program throw?public class Test { public static void ... (Read 18 times)

tnt_battle

  • Hero Member
  • *****
  • Posts: 556

Question 1

What exception type does the following program throw?

public class Test {
public static void main(String[] args) {
String s = "abc";
System.out.println(s.charAt(3));
}
}

◦ ArithmeticException
◦ ArrayIndexOutOfBoundsException
◦ StringIndexOutOfBoundsException
◦ ClassCastException
◦ No exception

Question 2

What exception type does the following program throw?

public class Test {
public static void main(String[] args) {
Object o = new Object();
String d = (String)o;
}
}

◦ ArithmeticException
◦ ArrayIndexOutOfBoundsException
◦ StringIndexOutOfBoundsException
◦ ClassCastException
◦ No exception


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by tnt_battle on May 6, 2020

tuwy

  • Sr. Member
  • ****
  • Posts: 336
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 39% of students answer this correctly




tnt_battle

  • Member
  • Posts: 556
Reply 2 on: May 6, 2020
:D TYSM


xiaomengxian

  • Member
  • Posts: 311
Reply 3 on: Yesterday
Excellent

 

Did you know?

As the western states of America were settled, pioneers often had to drink rancid water from ponds and other sources. This often resulted in chronic diarrhea, causing many cases of dehydration and death that could have been avoided if clean water had been available.

Did you know?

Anti-aging claims should not ever be believed. There is no supplement, medication, or any other substance that has been proven to slow or stop the aging process.

Did you know?

In 1886, William Bates reported on the discovery of a substance produced by the adrenal gland that turned out to be epinephrine (adrenaline). In 1904, this drug was first artificially synthesized by Friedrich Stolz.

Did you know?

In 2010, opiate painkllers, such as morphine, OxyContin®, and Vicodin®, were tied to almost 60% of drug overdose deaths.

Did you know?

Though the United States has largely rejected the metric system, it is used for currency, as in 100 pennies = 1 dollar. Previously, the British currency system was used, with measurements such as 12 pence to the shilling, and 20 shillings to the pound.

For a complete list of videos, visit our video library