# Learn Solidity Series 3: constructor **Published by:** [Renaissance Labs](https://paragraph.com/@renaissance-labs/) **Published on:** 2022-02-25 **URL:** https://paragraph.com/@renaissance-labs/learn-solidity-series-3-constructor ## Content Learn Solidity SeriesBefore Solidity 0.4.22默认构造方法与Java类似,如果未指定会采用默认的构造方法。当然,也可以明确指定构造方法。通过function指定了Solidity的构造方法,同时也可以像Java一样,给构造方法指定参数,但无法像Java那样创建多个重载的构造方法。pragma solidity ^0.4.21; contract DemoTest{ function DemoTest() public{ } } After Solidity 0.4.22使用constructor来定义构造函数pragma solidity ^0.4.22; contract DemoTest{ constructor() public{ } } ## Publication Information - [Renaissance Labs](https://paragraph.com/@renaissance-labs/): Publication homepage - [All Posts](https://paragraph.com/@renaissance-labs/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@renaissance-labs): Subscribe to updates