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
Over [174]
9 months ago
15

try the following code to see a nullpointer error (if you don’t see the error because of the autograding, you can copy it into t

he pencil icon scratch area to run it without the grader). since s is null, indexof throws an nullpointer error for s. comment out the first if statement and run the program again. the second if statement avoids the error with shortcircuit evaluation. because s !
Computers and Technology
1 answer:
gavmur [86]9 months ago
4 0

Using the knowledge of computational language in JAVA it is possible to describe  since s is null, indexof throws an nullpointer error for s. comment out the first if statement and run the program again. the second if statement avoids the error with shortcircuit evaluation.

<h3>Writting the code:</h3>

<em>public class Printer {</em>

<em>    private String name;</em>

<em>    public void print() {</em>

<em>        </em><em>printString</em><em>(name);</em>

<em>    }</em>

<em>public class Example {</em>

<em />

<em>    public static void </em><em>main</em><em>(String[] args) {</em>

<em>        Object obj = null;</em>

<em>        obj.hashCode();</em>

<em>    }</em>

<em />

<em>}</em>

<em>    public static void </em><em>main</em><em>(String[] args) {</em>

<em>        Printer printer = new Printer();</em>

<em>        printer.print();</em>

<em>    }</em>

<em>}</em>

<em>    }</em>

<em>public class Example {</em>

<em />

<em>    public static </em><em>void </em><em>main(String[] args) {</em>

<em>        Object obj = null;</em>

<em>        obj.hashCode();</em>

<em>    }</em>

<em />

<em>}</em>

<em>    public static void </em><em>main</em><em>(String[] args) {</em>

<em>        Printer printer = new Printer("123");</em>

<em>        printer.print();</em>

<em>    }</em>

<em>}</em>

See more about python at brainly.com/question/19705654

#SPJ1

You might be interested in
Write a Python program that prints your name, CS classes taken (or other relevant experience), and the date on separate lines. U
BigorU [14]

Answer:

The program in Python is as follows:

name = input("Name: ")

course = input("Course: ")

month = input("Month: ")

day = input("Day: ")

year = input("Year: ")

ddate = (month+"/"+day+"/"+year).replace(" ", "")

print("My name is ",name)

print("I have taken  ",course)

print("Today's date is ",ddate)

Explanation:

This line prompts user for name

name = input("Name: ")

This line prompts user for course classes taken

course = input("Course: ")

This line prompts user for month

month = input("Month: ")

This line prompts user for day

day = input("Day: ")

This line prompts user for year

year = input("Year: ")

This line calculates the date and remove all blank spaces

ddate = (month+"/"+day+"/"+year).replace(" ", "")

The next three lines print the user inputs

print("My name is ",name)

print("I have taken  ",course)

print("Today's date is ",ddate)

7 0
2 years ago
Maggie is preparing a business report. Which types of keys will she use to type out words and numbers?
nadya68 [22]
She would use enter period comma backspace
Hope this helps u
6 0
2 years ago
Read 2 more answers
In Java, a char variable is capable of storing any Unicode character. Write a statement that assigns the Greek letter ^ to a cha
miv72 [106K]

Answer:

public class Main

{

public static void main(String[] args) {

    char greekLetter = '^';

    System.out.println(greekLetter);

}

}

Explanation:

Create a char variable called greekLetter and set it to the ^

Print the greekLetter to the screen

7 0
3 years ago
write an assembly program that uses the output compare function of a timer to toggle an led every second
victus00 [196]

Answer:

...

Explanation:

8 0
2 years ago
A signal travels from point A to point B. At point A, the signal power is 100 W. At point B, the power is 90 W. What is the atte
11Alexandr11 [23.1K]

Answer:

Attenuation = 0.458\ db

Explanation:

Given

Power at point A = 100W

Power at point B = 90W

Required

Determine the attenuation in decibels

Attenuation is calculated using the following formula

Attenuation = 10Log_{10}\frac{P_s}{P_d}

Where P_s = Power\ Input and P_d  = Power\ output

P_s = 100W

P_d = 90W

Substitute these values in the given formula

Attenuation = 10Log_{10}\frac{P_s}{P_d}

Attenuation = 10Log_{10}\frac{100}{90}

Attenuation = 10 * 0.04575749056

Attenuation = 0.4575749056

Attenuation = 0.458\ db <em>(Approximated)</em>

7 0
3 years ago
Other questions:
  • Which of these symbols is a special character that is accessible only from the Symbol dialog box? A. © B. + C. é D.
    13·2 answers
  • Wich technology can a website use to allow you to listen to a concert live over the internet?
    10·1 answer
  • Who invented the machine known as colossus?
    9·2 answers
  • If you have configured your prompt so that it does not show your working directory, you can use the ____ command to verify in wh
    15·1 answer
  • What is the output?<br> &gt;&gt;&gt; phrase = "hello mom"<br> &gt;&gt;&gt; phrase upper()
    6·2 answers
  • Discuss five domains of Instructional technology​
    7·1 answer
  • Data type can only be true or false <br><br> Answer: Bool
    15·1 answer
  • Web résumés allow you to include extra graphics and images that you would not include in a traditional résumé. please select the
    9·1 answer
  • You use lpstat and determine that a user named User1 has placed two large print jobs in the queue for Printer1 that have yet to
    9·1 answer
  • Question 7 (1 point)
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!