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]
1 year 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]1 year 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
What does CPL stand for
ohaa [14]
I think it could be Cost Per Lead
4 0
4 years ago
Read 2 more answers
Question 3
goldfiish [28.3K]

Answer: Zero is output.

8 0
3 years ago
Ginny downloads and modifies an open source software program, then uploads the program with a different name. Which type of soft
abruzzese [7]

Answer:

The correct answer to the following question will be "GNU General Public License".

Explanation:

GNU General Public License:

  • This is a commonly used free and license open source that ensures the right to operate, test, distribute and change the program for end-users.
  • To prevent the GNU program from becoming proprietary, Richard Stallman developed the GPL. It is a basic use of his idea of the "copyleft."

If an individual alters and downloads a free software program, the program will then be uploaded with another name, then they would have to use this type of software license.

3 0
3 years ago
Suppose that you have just bought a new computer and you want to install soft- ware on that. Specifically, two companies, which
Gennadij [26K]

Answer:

#importing the time module

import time

#welcoming the user

name = raw_input("What is your name? ")

print "Hello, " + name, "Time to play hangman!"

print "

"

#wait for 1 second

time.sleep(1)

print "Start guessing..."

time.sleep(0.5)

#here we set the secret

word = "secret"

#creates an variable with an empty value

guesses = ''

#determine the number of turns

turns = 10

# Create a while loop

#check if the turns are more than zero

while turns > 0:          

   # make a counter that starts with zero

   failed = 0              

   # for every character in secret_word    

   for char in word:      

   # see if the character is in the players guess

       if char in guesses:    

   

       # print then out the character

           print char,    

       else:

   

       # if not found, print a dash

           print "_",      

       

       # and increase the failed counter with one

           failed += 1    

   # if failed is equal to zero

   # print You Won

   if failed == 0:        

       print "

You won"  

   # exit the script

       break              

   print

   # ask the user go guess a character

   guess = raw_input("guess a character:")  

   # set the players guess to guesses

   guesses += guess                    

   # if the guess is not found in the secret word

   if guess not in word:  

 

    # turns counter decreases with 1 (now 9)

       turns -= 1        

 

   # print wrong

       print "Wrong

"    

 

   # how many turns are left

       print "You have", + turns, 'more guesses'  

 

   # if the turns are equal to zero

       if turns == 0:            

   

       # print "You Lose"

           print "You Lose

"  

7 0
3 years ago
Which of the following types of tool should be used only on round work, such as rigid or IMC conduit?
Dafna11 [192]
Its C. A pipe wrench 
6 0
3 years ago
Read 2 more answers
Other questions:
  • The hotspot created by MiFi is password protected and can be used to connect Wi-Fi devices located within ____ feet of the MiFi
    9·1 answer
  • The set of rules for how computers talk to one another
    6·1 answer
  • Question 2 (2 points)
    9·1 answer
  • How to show neither precious nor accurate
    13·1 answer
  • A technician needs to be prepared to launch programs even when utility windows or the Windows desktop cannot load. What is the p
    11·1 answer
  • What information and options can be found on the File tab?
    8·1 answer
  • Judy forgot where she saved a certain file on her computer. Therefore, she searches for all files with a .jpg file extension. Wh
    7·2 answers
  • The process of preparing and setting up a software on a computer is called​
    15·1 answer
  • Hi good morning how are you all
    12·2 answers
  • A large retailer is asking each customer at checkout for their zip code. if the zip code is the only recorded variable, what is
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!