Explain below code syntax | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

Explain below code syntax

Object strObj = "string"; // what is this syntax String cStr = (String & CharSequence) strObj;

10th Dec 2019, 11:56 AM
Abhishek Thakur
Abhishek Thakur - avatar
1 Antwort
- 1
(String & CharSequence) strObj; tryes to reduce (access to) Object type fields to fields of String and CharSequence, but because every class types are subclass of Object there is not effect of lost functionality of strObj. String implements CharSequence, you can write (String) strObj; with same effect
11th Dec 2019, 1:33 AM
zemiak