Java Strings and Type Casting Explained

Day 14:- Strings A Journey with Frontlines EduTech (FLM) and Fayaz S ✒️ All String objects are store in Heap Area. Strings are write in two ways:- 1. Literals String s = "Tharun"; 2. Object:- ClassName objectName = new ClassName(); String s = new String("Tharun"); ✒️The literals are stored in String constant pool. ✒️The object is store in Head area. ✒️The string constant pool is a special memory area inside the heap where Java stores string literals to save memory and improves performance. ✒️When multiple Strings have the same value, Java stores only one copy in the pool. ✒️The string constant pool saves memory, increases performance and avoids duplicate string object. Day 15:- Type Casting :- ✒️The Type Casting in java means converting one data type into another data type. There are two types:- 1. Implicit type casting 2. Explicit type casting 1. Implicit type casting:- ✒️Converting a smaller data type into a larger data type automatically by java Ex:- byte->short->int->long->float->double 2. Explicit type casting:- ✒️converting a larger data types in to a smaller data type manually using casting. #Strings #java #corejava

  • text

To view or add a comment, sign in

Explore content categories