is string a primitive type or derived type?

String is not a primitive type, it is a derived type.

Example

public class Main {
 
    public static void main(String[] args) {
        String dataBase = "Oracle";
        System.out.println("DataBase: " + dataBase);
        String myWebsite = new String("w3spoint.com");
        System.out.println("Website: " + myWebsite);
    }
}

Output

Language: java
Website: w3spoint.com

Java interview questions on String Handling

Content Protection by DMCA.com
Please Share