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]
11 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]11 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
Using a conversation voice is part of:
MaRussiya [10]
Need more information
4 0
3 years ago
What is a distraction that you find when photographing animals at the zoo
yaroslaw [1]

D. All of the above.

<u>Reason:</u>

A. Fences can get in the way of a beautiful picture.

B: The animal's enclosure may be hard to get the perfect snap. Like a rock can be in the way of the animal. idk...lol

C. People want to see the animal as much as you do so they may block the way of a picture.

Example from Google..XD


7 0
3 years ago
Company Wizzy is having trouble with network security. Issues with authentication, viruses, malware/spyware, and other network i
Darya [45]

Answer:

B) security as a service I'm just doing the work

4 0
3 years ago
Directions: Give the shortcut key for the following commands: 1. Open 2. Save 3. New document 4. Copy 5. Undo 6. Redo 7. Paste 8
stepan [7]

Answer:

Explanation:

1 : Ctrl + X

2 Ctrl + C

3 Ctrl + L

4 Ctrl + V

5 Ctrl + B

6 Ctrl + R

7 Ctrl + I

8 Ctrl + E

9 Ctrl + U

10 Ctrl + Z

11 Ctrl + Y

12 Ctrl + N

End

13 Ctrl + A

Home

14 Ctrl + J

15 Ctrl + 2

16 Ctrl + S

17 Ctrl + 1

18 F12

19 Ctrl + W

-----------

20 Ctrl + K

21 Ctrl + ]

22 Ctrl + (left arrow)

23 Ctrl + (right arrow)

24 Ctrl + [

25 Ctrl + Del

26 Ctrl + 5

27 F1                                                         pls mark me as brainliest and              

                                                                   check all the short cuts

8 0
2 years ago
assume that name is a variable of type stirng that has been assigned a value write an expression whose value is the last charact
Snezhnost [94]

Answer:

The most straight forward way to do it: in general string are zero index based array of characters, so you need to get the length of the string, subtract one and that will be the last character, some expressions in concrete languages would be:

In Python:

name = "blair"

name[len(name) - 1]

In JavaScript:

name = "blair"

name[name.length - 1]

In C++:

#include <string>

string name = "blair";

name[name.length() - 1];

7 0
2 years ago
Other questions:
  • Describe in one or more complete sentences how someone starting a computer repair business in a town night gain a competitive ad
    15·1 answer
  • How can you logout your account and do not want to have this anymore
    12·2 answers
  • I dopped my Fujifilm Instax mini 8 and now the case won't close and it takes blank pictures can anyone tell me what to do, pleas
    6·2 answers
  • A(n) ____ is a user interface that allows users to interact with graphical objects and pointing devices.
    13·1 answer
  • What are two constraints that continuous-media files have that conventional data files generally do not have?
    12·1 answer
  • Question 3 of 10
    7·1 answer
  • The amount of time taken by each of 10 students in a class to complete an exam is an example of what type of data? a. Cannot be
    15·1 answer
  • 4.11 lesson practice edhesive
    8·2 answers
  • I will mark brainliest
    9·1 answer
  • Plz answer the following ​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!