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
Your computer is crashing on a regular basis. Which of the following is an operation available to the user that should help rese
Neko [114]

Answer

System restore

Explanation

System restore is a recovery feature that helps restore your system to the previous condition or point. Most computers have system restore disks which are an advantage to the users especially when the computer clashes.These disks are very effective when it comes to restoring the system to its initial state.

6 0
3 years ago
Read 2 more answers
How to reply to text from unknown number?
Leto [7]
Safest way: DO NOT reply and BLOCK number.

If you are not sure if the guy is related to some stuff, it will be better to call him back, instead of texting.
5 0
3 years ago
You found an image on the Creative Commons that you would like to use. How do you give credit to the author? *
Archy [21]
You need to write the author’s name
7 0
3 years ago
Read 2 more answers
Java’s class Color has a constructor that takes three integers as parameters: the red, green, and blue components of the color
Tanzania [10]

Answer:

    public Balloon(){

          //Invokes the 2 argument constructor for balloon with relevant  

          //parameters

          this(10,new Color(135,206,250));

    }

Explanation:

class Balloon{

    //Private fields in the Balloon class

    private double radius = 0;

    private Color c = null;

    // Constructor with two arguments - radius and Color

    public Balloon(double radius,Color c){

         this.radius = radius;

         this.c = c;

    }

    // No argument constructor

    public Balloon(){

          //Invokes the 2 argument constructor for balloon with relevant  

          //parameters

          this(10,new Color(135,206,250));

    }

}

3 0
4 years ago
What is the best data type for traveling day?
kykrilka [37]
Here if its wrong sorry

7 0
3 years ago
Other questions:
  • How can you check an orthographic drawing to be sure there are no missing lines
    11·1 answer
  • Which is better intel or amd real debate.
    12·2 answers
  • your computer running Windows 10 is doing some very strange things with operating system you are fairly certain it is not a hard
    13·2 answers
  • In which decade did cell phones become available to the public?
    8·1 answer
  • Write an algorithm for a program which inputs the lengths a, b and c of the three sides of a triangle. The program then determin
    9·1 answer
  • A brown outline around a frame is an indication of which tool?​
    13·1 answer
  • Select the correct answer from the drop-down menu.
    15·2 answers
  • Custom Offers empower Sellers to upsell even higher than their Premium Packages—but when should a Custom Offer be used?
    12·1 answer
  • 56- What is the term used when you press and hold the left mouse key and more the mouse
    8·1 answer
  • hello fellows i need a help.Ineed to know about computer evolutions and computer generations.please hurry.Its my rankover questi
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!