String[] str = {"a","b","c","d","e"}; 或String[] sql = new String[] {};
1、对String定义与赋值时使用: String[] str = {"a","b","c","d","e"}; 和String[] sql = new String[] {"a","b","c","d","e"};的区别是什么? 2、定义就是指String[] str; 赋值和初始化是指:str = {"a","b","c","d","e"};或str = ew String[] {"a","b","c","d","e"};?
谢谢!
最新回答
微浅笑°
2024-12-02 06:35:05
首先这两种方式都是创建了字符串数组。 但是第一种方式只创建了一个String[]数组对象str。 第二种方式创建了两个String[]数组对象sql和 new String[] {"a","b","c","d","e"},相当于我创建了 new String[] {"a","b","c","d","e"};这个对象,然后把这个对象的引用赋给sql对象。