<?php if(42 == "42") { echo '1.值相等'; } echo PHP_EOL; // 换行符 if(42 === "42") { echo '2.类型相等'; } else { echo '3.不相等'; } ?> <?php echo '0 == false: '; var_dump(0 == false); echo '0 === false: '; var_dump(0 === false); echo PHP_EO…
public class Variable{ static int allClicks=0; // 类变量 String str="hello world"; // 实例变量 public void method(){ int i =0; // 局部变量 } } public class Test{ public void pupAge(){ int age = 0; age = age + 7; System.out.println("小狗的年龄是: " + ag…
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </head> <body> <p>局部变量在声明的函数外不可以访问.</p> <p id="demo"></p> <script> myFun…
<?php echo "<h2>PHP 很有趣!</h2>"; echo "Hello world!<br>"; echo "我要学 PHP!<br>"; echo "这是一个", "字符串,", "使用了", "多个", "参数."; ?> <?php $txt1="学习…
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </head> <body> <p> typeof 操作符返回变量.对象.函数.表达式的类型.</p> <p id="demo"></p> <scri…
<?php echo date("Y/m/d") . "<br>"; echo date("Y.m.d") . "<br>"; echo date("Y-m-d"); ?> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</t…
public class StringDemo{ public static void main(String args[]){ char[] helloArray = { 'r', 'u', 'n', 'o', 'o', 'b'}; String helloString = new String(helloArray); System.out.println( helloString ); } } public class StringDemo { public static void mai…
public class PrimitiveTypeTest { public static void main(String[] args) { // byte System.out.println("基本类型:byte 二进制位数:" + Byte.SIZE); System.out.println("包装类:java.lang.Byte"); System.out.println("最小值:Byte.MIN_VALUE=" + Byte.M…
[可见度] interface 接口名称 [extends 其他的接口名] { // 声明变量 // 抽象方法 } import java.lang.*; //引入包 public interface NameOfInterface { //任何类型 final, static 字段 //抽象方法 } interface Animal { public void eat(); public void travel(); } public class MammalInt implements An…
Parent p = new Child(); public class Test { public static void main(String[] args) { show(new Cat()); // 以 Cat 对象调用 show 方法 show(new Dog()); // 以 Dog 对象调用 show 方法 Animal a = new Cat(); // 向上转型 a.eat(); // 调用的是 Cat 的 eat Cat c = (Cat)a; // 向下转型 c.work…