Advanced Java Programming

Image
                          Advanced Java Programming Advanced Java Programming :-   Introduction to advance java   As most of us already know that if we want to make normal applications it  can be easily built using core Java concepts. But, when it we need to develop web applications, advanced Java fundamentals, like JSP, Servlets, JDBC etc. needed, so to add capabilities and features of the application advance java is essential for developers. Through the motive of this blog is to explain about Advanced Java, I will be giving you a complete insight into the fundamental concepts of Advance Java. Figure - 1.2 If you want to see complete video on this please  have a look the video below.                              Learn with Resh u Advanced Java Programming Course ...

Introduction of String

Introduction of String



In Java, string is basically an object that represents sequence of char values. An array of characters works same as Java string.

For example:

char[] ch={’l',’e',’a',’r',’w',’i',’t',’h',’r',’e’,’s’,’h’,’u’};

String s=new String(ch);

is same as:

String s=”learnwithreshu";

The java.lang.String class implements Serializable, Comparable and CharSequence interfaces.

What is String in java?

Generally, String is a sequence of characters. But in Java, string is an object that represents a sequence of characters. The java.lang.String class is used to create a string object. then Question arises that 

How to create a string object? 

There are two ways to create String object:

By string literal

By new keyword

String Literal

Java String literal is created by using double quotes. 

For Example:

String s=”Reshu";

Each time you create a string literal, the JVM checks the "string constant pool" first. If the string already exists in the pool, a reference to the pooled instance is returned. If the string doesn't exist in the pool, a new string instance is created and placed in the pool. For example:

String s1=“Welcome";  

      String s2=“Welcome";

      s2 doesn't create a new instance 





 String objects are stored in a special 

 memory area known as the 

     "string constant pool".

By new keyword

In such case, JVM will create a new string object in normal (non-pool) heap memory, and the literal "Welcome" will be placed in the string constant pool. The variable s will refer to the object in a heap (non-pool).

String s=new String("Welcome"); //creates two objects and one reference variable


If you like this article please subscribe my blogs to encourage me to create more content like this.

If you want to understand this in hindi Please click the play button. 



Thanks for Watching!!!!!!

Best Regards
Learn with Reshu
#learnwithreshu


Comments

Popular posts from this blog

Learn Complete OOPS Concepts in one Project

Spring Core