如何创建对象的实例并将其分配给字段? [英] How do i create an instance of an object and assign it to a field?
本文介绍了如何创建对象的实例并将其分配给字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
JAVA LANGUAGE:
写一个没有参数的构造函数,并在正文中创建一个新的对象实例,分配给食品领域。
我尝试了什么:
我试过查看多个YouTube视频如何找到答案,因为我还没有足够的编码经验。
JAVA LANGUAGE:
Write a constructor with no parameters and in the body create a new instance of an object to assign to the foods field.
What I have tried:
I've tried looking through multiple youtube videos on how to find the answer as I do not have enough coding experience yet.
推荐答案
Lesson:类和对象(Java教程 - 学习Java语言) [ ^ ]。
这篇关于如何创建对象的实例并将其分配给字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文