Core Java with OCJP/SCJP: Language Fundamentals Part-7 || Arrays part-2

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

at this moment its quite hard for me to continue my study my father lost his job and i really cant afford to pay for tuition all i am learning is right now from your videos and preparing for my upcoming exams and trust me sir even if i pay 10000 rs for my tuition class i wont even get quality teaching like you are doing here on youtube thanks alot .

benkkstudio
Автор

Sir, I am OCA certified still i could never understand java this well before. Thankyou for being such a best lecturer, surely will recommend this to my other peers also. Keep teaching. Thankyou Sir :)

nandini
Автор

Day 5 - 21/Oct/2023
Language Fundamentals -
Lecture 7 completed ✅
Thankyou sir!

dreamer__
Автор

never seen such a teaching style
i am a great fan of you sir

ssathwik
Автор

Great teaching Style sir(Mind blowing Explanation)Each and every point are crystal clear😍🙏🙏🤩

RkRoy-crql
Автор

you are much better than most of my senior who are having 5-years of experience.

rishisrivastava
Автор

Sir i have learnt more from it than a 1000 rs coaching
IT is too much
THANKING YOU

themster
Автор

Never knew about this concept of array and all the loop holes.. Thanks sir for such informative lecture.

mokshadanayak
Автор

Learning Java process going on. Like this if you also doing with me

-AjayChauhan
Автор

Sir your teaching style is amazing, you are my favorite teachers

Manindersingh-bxqc
Автор

Notes for the above video

Array of Arrays



2 dimensional Array creation

In java 2 dimensional Array not implemented by using matrix style sun people followed the Array of Arrays approach for multi-dimensional Array creation
The main advantage of this approach is memory utilization will be improved.

Example 1

int[][] x=new int[2][];
x[0]=new int[2];
x[1]=new int[3];

Example 2 3 dimensional Array

int[][][] x=new int[2][][];
x[0]=new int[3][];
x[0][0]=new int[1];
x[0][1]= new int[2];
x[0][2]=new int[3];
x[1]=new int[2][2];

which of the following array declarations are valid

int[] a= new
int[] a= new
int[][] a= new
int[][] a= new
int[][] a= new without specific base size how we can specify the next level
int[][] a= new
int[][][] a= new int[3][4][5]; valid
int[][][] a= new int[3][4][]; valid
int[][][] a= new int[3][][5]; invalid
int[][][] a= new int[][4][5]; invalid

Array initialization

once we create an array every element by default initializer with default values

class Test {
public static void main(String[] args)
{
int[] x= new int[3];
System.out.println(x[0]); //0
}
}

whenever we are trying to print any reference variable internally 2 string method will be called which is implemented by default to return the string in the following form


Example 2

class Test {
public static void main(String[] args)
{
int[] x= new int[2][3];
System.out.println(x[0][0]); // 0
}
}


Example 3

class Test {
public static void main(String[] args)
{
int[] x= new int[2][];
System.out.println(x[0]); //null
System.out.println(x[0][0]); // RE : Null pointer Exception
}
}

note: if we are trying to perform any operation on null then we will get a run time exception saying null pointer exception

once we create an array every array element by default is initialized with default values if we are not satisfied with default values then we can override these values with our
customized values

int[] x= new int[6];
x[0]=10;
x[1]=20;
x[2]=30;
x[3]=40;
x[4]=50;
x[5]=60;


x[6]=70; invalid RE: Array indexed out of Bound Exception
x[-6]=80; invalid RE: Array indexed out of Bound Exception
x[2.5]=90; invalid ce: possible loss of precision found double required is int

if we are trying to access an array element with of range index (either +ve value or - ve int value) then we will get a run time exception
Array index out-of-box exception.

gopikrishna
Автор

durga sir looks like south movie star karthi 😊😊

salmansiddiqui
Автор

He is a god of JAVA for me .. Hats offs u sir ...

karthikeyanzohocorporate
Автор

sir, you are god to java technology, your teaching is awesome

ashokmandadi
Автор

Thanks sir..all your passion reflects in your teaching..God bless you😊

monalisapanda
Автор

Very clear explanation sir... its really helpful to us for upskilling.. thank you so much for your effort... all the best and keep going 👍

visasadhasivam
Автор

your teaching is vry nice sir, and simple to learn java, thanku so much sir
☺🤗☺

dhananjaykumar
Автор

Thank you Durga Sir, You are a gem!!
God Bless

deepaknegi
Автор

You are God Sir, I have tried both online and offline coaching but you make the term justified "teaching ". I admire your way to impart knowledge this way. Hats off Sir, big Respect!

malvika
Автор

You're superb sir, I haven't any words to appreciate you. Bcoz You're legend😎

priyasharma-pioc