11 winterleaf123

尚未进行身份认证

暂无相关简介

等级
TA的排名 2w+

without synchronized keyword

package HeadFirstJava;class BankAccount { private int balance = 100; public int getBalance() { return balance; } public void withdraw(int amount) { balance = bal

2015-07-30 10:33:51

synchronized keyword DEMO

package HeadFirstJava;class BankAccount { private int balance = 100; public int getBalance() { return balance; } public void withdraw(int amount) { balance = bal

2015-07-30 10:32:31

start 2 threads

package HeadFirstJava;public class RunThreads implements Runnable { public static void main(String[] args) { RunThreads runner = new RunThreads(); // make a Runnable object Thre

2015-07-30 09:48:37

use sleep() to gain thread predictability

package HeadFirstJava;class MyRunnable implements Runnable { public void run() { go(); } public void go() { try { Thread.sleep(2000); } catch(Interrup

2015-07-30 09:37:27

thread unpredictability

package HeadFirstJava;class MyRunnable implements Runnable { public void run() { go(); } public void go() { doMore(); } public void doMore() { System.out.

2015-07-30 09:24:16

String::split() DEMO

package HeadFirstJava;public class TestJava { public static void main(String[] args) { String toTest = "What is blue + yellow?/green"; String[] result = toTest.split("/");

2015-07-29 10:08:15

read text file DEMO

package HeadFirstJava;import java.io.*;class ReadAFile { public static void main(String[] args) { try { File myFile = new File("MyText.txt"); FileReader fileRea

2015-07-29 10:01:08

write to text file DEMO

package HeadFirstJava;import java.io.*;class WriteFile { public static void main(String[] args) { try { FileWriter writer = new FileWriter("Foo.txt"); writer.wr

2015-07-29 09:35:47

serialization DEMO

package HeadFirstJava;import java.io.*;@SuppressWarnings("serial")public class Box implements Serializable { @SuppressWarnings("unused") private int width; @SuppressWarnings("unused")

2015-07-29 09:21:50

JTextArea DEMO

package HeadFirstJava;import javax.swing.*;import java.awt.*;import java.awt.event.*;public class TextArea1 implements ActionListener { JTextArea text; public static void main(Strin

2015-07-29 08:36:24

box layout DEMO

package HeadFirstJava;import javax.swing.*;import java.awt.*;public class Panel1 { public static void main(String[] args) { Panel1 gui = new Panel1(); gui.go(); } publi

2015-07-29 08:19:10

flow layout DEMO

package HeadFirstJava;import javax.swing.*;import java.awt.*;public class Panel1 { public static void main(String[] args) { Panel1 gui = new Panel1(); gui.go(); } publi

2015-07-29 08:09:08

Border Layout demo

package HeadFirstJava;import javax.swing.*;import java.awt.*;public class Button { public static void main(String[] args) { Button gui = new Button(); gui.go(); } publi

2015-07-28 11:58:15

button with a big font

package HeadFirstJava;import javax.swing.*;import java.awt.*;public class Button { public static void main(String[] args) { Button gui = new Button(); gui.go(); } publi

2015-07-28 11:48:29

BorderLayout manager DEMO

package HeadFirstJava;import javax.swing.*;import java.awt.*;public class Button { public static void main(String[] args) { Button gui = new Button(); gui.go(); } publi

2015-07-28 11:40:23

event source => listener

package HeadFirstJava;import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.*;public class SimpleGui { JButton button; public

2015-07-28 11:20:08

2 event sources & inner class

import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.*;@SuppressWarnings("serial")class MyDrawPanel extends JPanel { public void paint

2015-07-28 10:00:48

draw something in Java DEMO

import java.awt.*;import javax.swing.*;@SuppressWarnings("serial")class MyDrawPanel extends JPanel { public void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; G

2015-07-28 09:27:59

event handling in Java

import javax.swing.*;import java.awt.event.*;public class SimpleGui implements ActionListener { JButton button; public static void main(String[] args) { SimpleGui gui = new Si

2015-07-28 09:03:48

Java simple GUI DEMO

import javax.swing.*;public class SimpleGui { public static void main(String[] args) { JFrame frame = new JFrame(); JButton button = new JButton("click me"); fra

2015-07-28 08:50:15

查看更多

勋章 我的勋章
  • 持之以恒
    持之以恒
    授予每个自然月内发布4篇或4篇以上原创或翻译IT博文的用户。不积跬步无以至千里,不积小流无以成江海,程序人生的精彩需要坚持不懈地积累!