Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
226 views
in Technique[技术] by (71.8m points)

java - Why we need an empty Constructor to passing/save a Data From Firebase?

maybe this question little bit easy, but I don't get any idea why we need an empty constructor to passing a data from Firebase. Here is an example for the code:

public class Hero{
String Name, Weapon, Description, Price, Discount, Id;

public Hero() {
}

public Hero(String name, String weapon, String description, String price, String discount, String id) {
    Name = name;
    Weapon= weapon;
    Description = description;
    Price= price;
    Discount = discount;
    Id= id;
}}

then we need a getter and setter for each Menu..

But whats make dizzy is, Why we need an empty Constructor? Is that really necessary?

Can we just make a class without typing an empty constructor? is this will be the same result?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...