TutorMe homepage
Subjects
PRICING
COURSES
Start Free Trial
Himanshu S.
Principal Software Engineer with 10+ years of experience
Tutor Satisfaction Guarantee
Java Programming
TutorMe
Question:

What do you understand by Immutable class? Give examples of Immutable classes from core java library.

Himanshu S.

An immutable object is one that will not change state after it is instantiated. In general, an immutable object can be made by defining a class which does not have any of its members exposed and does not have any setters. The following class will create an immutable object: class ImmutableInt { private final int value; public ImmutableInt(int i) { value = i; } public int getValue() { return value; } } String class and primitive wrapper classes like Integer, Float are an example of immutable classes from core java library.

Basic Math
TutorMe
Question:

Solve (x - 3)^2 = 4

Himanshu S.

x - 3 = ±2 Square root property x = 3 ± 2 Add 3 to both sides x = 3 + 2 or x = 3 - 2 Two solutions x = 5, 1

Algebra
TutorMe
Question:

The ages of the two persons differ by 20 years. If 5 year ago, the older one be 5 times as old as the younger one, then their present ages, in years are:

Himanshu S.

Let the age be x and y years now. Then, x−y=20 and (x−5)=5(y−5) On solving both equations we get: x=30 and y=10

Send a message explaining your
needs and Himanshu will reply soon.
Contact Himanshu