Let's learn java programming language with easy steps. This Java tutorial provides you complete knowledge about java technology.

Monday, 24 May 2021

First "Hello World" Program in Python

 Hello World Program in Python

Here we going to learn a very very simple program or you can say the first program in python programming language which is "Hello World" program. Here we are going to print a simple massage in python programming language, massage is "Hello World".

Hello World Example in Python

x = "Hello World"
print x

Now it will print Hello World on a console when you running python program.

In the above example, x is a variable and print is used to print the message which x is containing i.e Hello World.
Share:

Sunday, 23 May 2021

What is NullPointerException in Java with Examples

 Java "NullPointerException" Program

Here we are going to learn what NullPointerException in java with an example. So let's start the simple java null pointer exception program.

When we call any method by using any reference which is assigned null value then nullpointerexception occurs in java. Let's take a simple example of Java NullPointerExcepton which is given below.

NullPointerException Example in Java

class NullPointerExceptionExample
{
public void show()
{
System.out.println("not running");
}
public static void main(String args[])
{
NullPointerExceptionExample npl = null;//assigning null value to this reference
npl.show();
}
}

Now above java program will throw NullPointerException.

So, here we learned what is null pointer exception in java and when it occurs in java programs.


Share:

Facebook Page Likes

Follow javatutorial95 on twitter

Popular Posts

Translate