随笔分类 -  java

上一页 1 2

this()方法的使用
摘要:class exercise { int m,n; String a,b; exercise() { } exercise(int m,String a) { this.m=m; this.a=a; } exercise(int m, int n,String a,String b) { this. 阅读全文

posted @ 2017-05-21 14:52 Iitb 阅读(343) 评论(0) 推荐(0)

get()和set()方法
摘要:例1 class MyPoint { private int x; private int y; public int getx() { return this.x; } public int gety() {return this.y;} public void setx(int x) {this 阅读全文

posted @ 2017-05-21 14:49 Iitb 阅读(170) 评论(0) 推荐(0)

PI=4+4/3+4/5+...
摘要://求PI=4+4/3+4/5+...... public class PITest { public static void main(String[ ] args) { double m,f,sum,t ; int count =0; f=4.0; sum=0.0; t=1; m=1; whil 阅读全文

posted @ 2017-05-21 11:51 Iitb 阅读(104) 评论(0) 推荐(0)

百钱买百鸡
摘要://百钱买百鸡,怎么买? public class MaiJi { public static void main(String[] args) { int x,y,z;//x公鸡,y母鸡,z小鸡 for (x=0;x<=20;x++) for (y=0;y<=33;y++) for(z=0;z<= 阅读全文

posted @ 2017-05-21 11:42 Iitb 阅读(88) 评论(0) 推荐(0)

猴子吃桃
摘要://一个猴子摘了很多桃子,第一天吃了一半还多一个,以后每天都吃一半还多一个,第6天刚好吃完。问第一天摘了多少桃子? //1.剩x/2-1个 //2.有y个 所以,y=x/2-1即 x=2/(y+1) public class Houzi { public static void main(Strin 阅读全文

posted @ 2017-05-21 11:36 Iitb 阅读(87) 评论(0) 推荐(0)

构造方法
摘要:构造方法:1)方法名和类名完全一致 2)没有返回值 class student { String stuID; String stuName; String stuSex; } public class studentTest1 { public static void main(String [] 阅读全文

posted @ 2017-05-21 11:30 Iitb

方法的重载
摘要:方法的重载:1)方法名相同,参数个数不同 2)方法名相同,参数类型不同 3)方法名相同,参数顺序不同 class student { String stuID; String stuName; String stuSex; student() { stuID="s01"; stuName="张三"; 阅读全文

posted @ 2017-05-21 11:09 Iitb 阅读(122) 评论(0) 推荐(0)

静态变量(static)
摘要:static 类变量(静态变量) 调用方法:类.static对象 class student { String stuID; String stuName; static int count =0; student() { count ++; } student (String ID ,String 阅读全文

posted @ 2017-05-20 22:20 Iitb 阅读(144) 评论(0) 推荐(0)

netBeans 清空jTable中的所有数据
摘要:1. DefaultTableModel tableModel = (DefaultTableModel) jTable1.getModel(); ((DefaultTableModel) jTable1.getModel()).getDataVector().clear(); //清除表格数... 阅读全文

posted @ 2015-01-12 22:57 Iitb 阅读(876) 评论(0) 推荐(0)

netBeans学习中遇到的问题
摘要:1.找不到主类:重建项目,再将之前的代码复制过来||改变之前项目的放置位置||库里面的Beans调试程序删掉 2.运行的界面不正确:项目->属性->运行->主类设为需要运行的项目名,运行->清理构建项目,重启netBeans软件 3.关闭子窗体时,父窗体任然存在,设置窗体属性->setDefau... 阅读全文

posted @ 2015-01-12 22:22 Iitb 阅读(167) 评论(0) 推荐(0)

计算一个数的平方
摘要:package JPackage;import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.*;public class TestWindow... 阅读全文

posted @ 2014-10-22 22:52 Iitb

JColorChooser设置窗体颜色
摘要:import javax.swing.*;import java.awt.event.*;import java.awt.*;import javax.swing.JColorChooser;public class JButtonColor { /** * @param args */ pub... 阅读全文

posted @ 2014-10-22 22:44 Iitb 阅读(248) 评论(0) 推荐(0)

Button改变面板颜色
摘要:import javax.swing.*;import java.awt.event.*;import java.awt.*;public class JButtonColor1 extends JFrame{ /** * @param args */ public JButtonColor... 阅读全文

posted @ 2014-10-22 22:39 Iitb 阅读(260) 评论(0) 推荐(0)

charAt方法
摘要:获取字符串某一特定位置的字符:char charAt(int index)import javax.swing.*;public class charAt {/** * @param args */public static void main(String[] args) {// TODO Aut... 阅读全文

posted @ 2014-10-20 15:21 Iitb 阅读(219) 评论(0) 推荐(0)

字符串的连接concat(String str)方法
摘要:import javax.swing.*;public class concat {/** * @param args */public static void main(String[] args) {// TODO Auto-generated method stub String str1="... 阅读全文

posted @ 2014-10-20 15:18 Iitb 阅读(1300) 评论(0) 推荐(0)

JButton的练习
摘要:import java.*;import java.awt.Container;import java.awt.Event.*;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.Act... 阅读全文

posted @ 2014-10-20 15:07 Iitb 阅读(212) 评论(0) 推荐(0)

上一页 1 2

导航