- 博客(10)
- 收藏
- 关注
原创 Java中创建对象的几种方式。
Java中创建对象的四种方式。1、使用new关键字调用构造函数创建对 Student s1 = new Student("huiye",16,100.00); System.out.println(s1); Student{name='huiye', age=16, weight=100.0}2、利用反射创建对象2.1、使用Class对象的newInstance() 方法 Class<Student> c = Student.class;
2022-08-06 17:12:00
4335
4
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅