`
张玉龙
  • 浏览: 723156 次
  • 性别: Icon_minigender_1
  • 来自: 沈阳
社区版块
存档分类
最新评论
文章列表
package com.zyl; public class ToStringTest { /*toString()方法返回对象的字符串表示; 也就是当打印输出一个对象时,系统自动调用其toString方法,打印的是toString方法的返回值。 如:*/ int x = 0; int y = 0; public String toString() { return "("+x+","+y+")"; } public static void main(String[ ...
public class multiplicationTable{ long n; public void mul(long n){ for(long i=1;i<n;i++){ System.out.print("\n"); for(long j=1;j<i+1;j++){ System.out.print( i+"*"+j+"="+i*j+" " ); } } } public static void main(St ...
public class Shape{ private String name; protected double area; public Shape(String name){ this.name=name; } public String getName(){ return this.name; } public double countArea(){ return 0.0; } } class Rectangle extends Shape{ ...
package com.zyl; public class GetterAndSetter{ String abc="Hello world"; public String getAbc() { return abc; } public void setAbc(String abc) { this.abc = abc; } public static void main(String[] args) { GetterAndSetter aaa=new GetterAndSetter(); aaa.a ...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; chars ...
package com.zyl; public class ArithmeticDemo{ public int devide(int a,int b){ //if(b==0) //throw new ArithmeticException("b不能为0"); return a/b; } public double devide(double a,double b){ // if(b==0) // throw new ArithmeticException("b不能为0D"); / ...
//Java 用bufferReader 读取控制台输出的内容,并转换成整形,定义异常 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class BufferReader { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader input = new BufferedR ...
ThisTest.java public class ThisTest { String s = "Hello"; public Hello(String s) { System.out.println("s = " + s); System.out.println("1 -> this.s = " + this.s); this.s = s; System.out.println("2 -> this.s = " + this.s); } public ...
package com.zyl; import java.util.HashSet; import java.util.Iterator; import java.util.Set; public class HashSetTest { public static void main(String[] args){ Student stu1 = new Student("zyl",32,100.0); Student stu2 = new Student("张玉龙",22,59.9); ...
import java.io.FileReader; import java.util.ArrayList; import java.util.List; public class ReadFile { public static void main(String[] args) throws Exception { FileReader fr = new FileReader("D:\\info.txt"); int read; String str = ""; List<Student> ...
JDBCServlet.java package com.zyl.servlet; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; public class JDBCServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws Ser ...
MessageServer.java package com.zyl; import java.net.*; import java.io.*; /** * 在10000端口下监听 网路上的应用程序连接 并发送字符串信息到网路客户端程序 */ public class MessageServer { public static void main(String[] args) throws Exception { // ...
Student.java package com.zyl; public class Student implements Comparable<Student>{ private Long studentId; private String name; public Student(){ } public Student(Long studentId,String name) { this.studentId=studentId; this.name = name; } public Long getStudentId() ...
Gen.java package com.zyl; public class Gen<T> { private T ob; // 定义泛型成员变量    public Gen(T ob) { this.ob = ob; } public T getOb() { return ob; } /*public void setOb(T ob) { this.ob = ob; }*/ public void showType() { System.out.println("T的实际类型是: " ...
testA.jsp <html> <head> <title>示例</title> </head> <body > <form method="post" action="testB.jsp" > <input type="text" name="yourName" > <input type="button"value="提交" onCl ...
Global site tag (gtag.js) - Google Analytics