java 知識點(diǎn)總結(jié)_第1頁
java 知識點(diǎn)總結(jié)_第2頁
java 知識點(diǎn)總結(jié)_第3頁
java 知識點(diǎn)總結(jié)_第4頁
java 知識點(diǎn)總結(jié)_第5頁
已閱讀5頁,還剩10頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、The “White Paper ” Buzzwords Simple簡潔 Object-Oriented面向?qū)ο蟮?Distributed分布式(對網(wǎng)絡(luò)文件處理) Robust健壯性(可靠性,減少程序錯(cuò)誤) Secure安全性(沙盒) Architecture-neutral結(jié)構(gòu)中立(JVM,WORA) Portable可移植 Interpreted解釋型 High-performance高效性 Multithreaded并發(fā)性 Dynamic動(dòng)態(tài)性JVM Java Virtual MachineJDK Java Development KitJRE Java Runtime Environ

2、mentIDE Integrated Development Environment集成開發(fā)環(huán)境GUI Graphical User InterfaceApplication vs. Appletenum typeenum typeenum Size SMALL, MEDIUM, LARGE, EXTRA_LARGE ;Size s = Size.MEDIUM; stringstringString greeting = Hello; String s = greeting.substring(1, 3);StringBuilder builder = new StringBuilder();

3、builder.append(a); builder.append(“cat”); String completedString = builder.toString();Predefined classPredefined classDate b_day = new Date();System.out.println(b_day);/ get the yearSystem.out.println(b_day.getYear();System.out.println(b_day.getMonth();.factory methodsfactory methodsLocalDate rightN

4、ow = LocalDate.now();LocalDate newYearsEve = LocalDate.of(2017, 9, 25);System.out.println(rightDate.getYear(); System.out.println(rightDate.getMonthValue();System.out.println(rightDate.getDayOfMonth();SpecialSpecialfinal 只生成一次static :A static field is also called a class field, which means that the

5、static field is shared across all its objects.只保存最近賦值,所有對象通用,類似unionstatic final:A static final field is a shared constant across all its objectscommentcommentMulti-line comments:/* like this . */Documentation comments:/* * This is the first sample program in Core Java Chapter 3 * version 1.01 1997-

6、03-22 * author Gary Cornell */LiteralsLiteralshex 0 xCAFEoctal 031Binary 0b1111_0100_0010_0100_0000Double.POSTIVE_INFINITY正無窮大Double.NEGATIVE_INFINITY 負(fù)無窮大Use super to avoid recursive callUse super to avoid recursive callpublic class Manager extends Employee private double bonus;public double getSal

7、ary() return super.getSalary() + bonus; Object: The Cosmic SuperclassObject: The Cosmic SuperclassAny object or array reference can be stored in a variable of type Object:System.out.println(Employee)obj1).getName();Object obj2 = new int10;(int)obj2)0 = 1;System.out.println(int)obj2)0);ArrayListArray

8、ListArrayList eList = new ArrayList();eList.add(LiLei);/ Print the second oneSystem.out.println(eList.get(1);/ Set the second to JerryeList.set(1, Jerry);Special objectsSpecial objectsIntegerDoubleLambdaLambdaArrays.sort(intArr, new Comparator() public int compare(Integer i, Integer j) return j - i;

9、Arrays.sort(stus, (s1,s2) - s2.getName().compareTo(s1.getName();System.out.println(Arrays.toString(stus);ComparatorComparatorArrays.sort(stus, new Comparator() public int compare(Student s1, Student s2) return s2.getName().compareTo(s1.getName(););ScreenSizeScreenSizeDimension screenSize = Toolkit.g

10、etDefaultToolkit().getScreenSize();Resizable()drawdrawDrawLineDrawRectDrawOvalLayoutLayoutFlow LayoutThe default layout of JPanelBorder LayoutThe default layout of JFrameGrid LayoutScrollPaneScrollPaneJScrollPane scrollPane = new JScrollPane(textArea);setbackgroundcolorsetbackgroundcolorbRed.addActi

11、onListener(e) - getContentPane().setBackground(Color.red);bPanel.setBackground(Color.red););ChangefontChangefontActionListener checkbListener = event - int mode = 0; if (bold.isSelected() mode += Font.BOLD; if (italic.isSelected() mode += Font.ITALIC; label.setFont(new Font(Serif, mode, FONTSIZE);Co

12、mbpBoxCombpBoxJComboBox faceCombo = new JComboBox();faceCombo.addItem(Serif);faceCombo.addItem(SansSerif);faceCombo.addItem(Monospaced);faceCombo.addItem(Dialog);faceCombo.addItem(DialogInput);faceCombo.addActionListener(event -label.setFont( new Font(String)faceCombo.getSelectedItem(), Font.PLAIN,

13、24);menubarmenubarsetJMenuBar();toolbartoolbarJToolBar bar = new JToolBar();/ Define a button with a given iconJButton btnRed = new JButton(new ImageIcon(red-ball.gif);/ Specify the actionbtnRed.addActionListener(e - label.setForeground(Color.red);/ Add the button to the barbar.add(btnRed);Message DialogJOptionPane.showMessageDialog(null, Hello the Dialog World!);Confirm Dialog Returns an integer indicating the option selected by the user Yes : 0 No : 1 Cancel : 2 Close : -1int retConfirm = JOptionPane.s

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論