0% found this document useful (0 votes)
4 views1 page

Java Concepts Simplified

The document explains key Java concepts including the difference between '==' and '.equals()', static vs non-static variables, and the distinctions between arrays and ArrayLists. It also highlights that Strings are immutable and provides common methods for Collections such as sorting and finding maximum or minimum values. These explanations are aimed at simplifying complex Java topics for better understanding.

Uploaded by

kpmoviez360
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Java Concepts Simplified

The document explains key Java concepts including the difference between '==' and '.equals()', static vs non-static variables, and the distinctions between arrays and ArrayLists. It also highlights that Strings are immutable and provides common methods for Collections such as sorting and finding maximum or minimum values. These explanations are aimed at simplifying complex Java topics for better understanding.

Uploaded by

kpmoviez360
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Java Confusing Concepts - Explained Simply

1. == vs .equals()

`==` reference check karta hai, `.equals()` value check karta hai.

Example:

String a = new String("hello");

String b = new String("hello");

a == b -> false (alag object)

[Link](b) -> true (same content)

2. Static vs Non-static

Static cheez class level hoti hai, object banane ki zarurat nahi.

Non-static cheez object level hoti hai.

Example:

static int count = 0; // sab objects ke liye common

3. Array vs ArrayList

Array - fixed size, primitive bhi store kar sakta hai.

ArrayList - dynamic size, sirf objects store karta hai (like Integer, String).

4. String Immutable hota hai

String ka ek baar value ban gaya, toh change nahi hota.

Har modification naya String object banata hai.

5. Collections Methods

Common methods:

- sort(list): list ko ascending order me sort karta hai

- reverse(list): list ko ulta karta hai

- max/min: max ya min element deta hai

- frequency(list, val): element ki frequency count karta hai

You might also like