def say_goodnight(name) result ="Good night ." +name return result end def say_goodmorning(name) result ="Good morning .#{name}" return result end def say_goodafternoon(name) result ="Good afternoon .#{name}" end puts say_goo…
Java针对类.成员变量.方法,有很多修饰符,例如public.private.static.final.synchronized.abstract等,这些修饰符用来控制访问权限或其他特性. 本文就用成员变量(Field)来举例说明,类以及方法的修饰符获取与成员变量是一样的. 先看一个类 public class MyTest { public int a; public static int b; public static final int c = 0; private int d; }…
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <script type="text/javascript"> var a = 100; function t() { alert(a); var a = 10; } t(); //输出结果为undefine…