---
title: "Super和this"
author: "maybe723"
date: "2008-05-06T10:39:01Z"
tags: []
slug: "super-this"
draft: false
lastmod: "2008-05-06T10:39:01Z"
id: 190037
url: "https://maybe723.iteye.com/blog/190037"
---

Super的使用:对于构造函数，必须是构造函数的第一行,即为super(),super(10)等，在其他的非静态方法中，super.i,super.method();

This的使用：对于构造函数，必须是构造函数的第一行,即为this(),this(10)等, 在其他的非静态方法中，this.i,this.method();

在静态方法中不能使用this和super, 它只能在实例方法、函数闭包和全局代码中使用, 不能在静态成员的内部使用 this 关键字，因为 this 可能没有上下文。