02 C h a p t e r Java
Bioinformatics in J a va,, 2 1,,,, C++, Python, (Java),,, (http://wwwbiojavaorg),, 13, 3D GUI,,, (Java programming language) (Sun Microsystems) 1995 1990 (green project) TV 22
CHAPTER 02,, C++, C++ C++,,,,, C++ (pseudo code) 1 10 sum <-- 0 i <-- 1 i 1 0 sum <-- sum + i i <-- i + 1 s u m, sum i 0 1 sum i sum, i 1 i sum i 1 2 i 2 10 1 sum i 2 1 2, 3 23
Bioinformatics in J a va i 3, s u m 1 2 3 4 5 6 7 8 9 10 sum 10, i 11, 11 10 sum C Perl 0 1 #include <stdioh> 0 2 void main(void) { 0 3 int sum = 0; 0 4 int i = 1; 0 5 while(i<=10) { 0 6 sum = sum + i; 0 7 i = i + 1; 0 8 } 0 9 printf("sum : %d\n", sum); 1 0 } 0 1 $sum = 0; 0 2 $i = 1; 0 3 while($i<=10) { 0 4 $sum = $sum + $i; 0 5 $i = $i + 1; 0 6 } 0 7 print "$sum\n"; C, Perl C main( ), Perl Perl C, Perl,,,, 24
CHAPTER 02 (method), public class { } public static void main(string[] args) { } ( ) 0 1 public class FirstProgram { 0 2 public static void main(string[] args) { 0 3 int sum = 0; 0 4 int i = 1; 0 5 while(i<=10) { 0 6 sum = sum + i; 0 7 i = i + 1; 0 8 } 0 9 S y s t e m o u t p r i n t l n ( s u m ) ; 1 0 } 1 1 } FirstProgram, C main( ) main( ), main( ) 25
Bioinformatics in J a va 2 2 (class),,,,,,,,, /,,, 26
CHAPTER 02 21,,,,,,,, DNA, RNA 4 DNA FirstProgram, 22 27
28 C M Y K Bioinformatics in J a va 4 5, 3 22 class, { } public, private, protected,,,, FirstProgram main 28
CHAPTER 02 (, ) {, } ( a rg u m e n t ) (parameter) void {, } public, private, protected 3 main( ),, 4 class { } // // 2 3 (specify),, import,, 29
import javaio*; (io) Java API(http://javasuncom/j2se/142/docs/api/) javalang javaio javautil javaawt, javaxswing 30 Bioinformatics in J a va
CHAPTER 02 2 4,,, CC++ C/C++, C/C++, C C++, Perl, (data type),, (primitive type) (number type), (character type), (boolean type), byte(8 ), short(16 ), int(32 ), long(64 ), float(32 ), double(64 ) IEEE 754 31
Bioinformatics in J a va (char) (boolean) 16 char 2, boolean true false 1 int[] intlist1, intlist2; short shortmatrix[][]; Calculator[] calcarray;, int[ ] intlist1; Calculator[ ] calcarray; new new 3 intlist1 intlist2, 100 s h o r t shortmatrix, 5 calcarray intlist1 = new i n t [ 3 ]; intlist2 = new i n t [ 3 ]; shotmatrix = new s h o r t [ 10 ][ 10 ]; calcarray = new C a l c u l a t o r [ 5 ]; 32
CHAPTER 02,,, (index) [ ] 1 0 intlist[0] = -30; intlist[1] = 38; intlist[2] = 2; C/C++ C C++ String String C C++ ( ), new String str = "BIO"; String str2 = new String("JAVA");, String (concatenate) String str3 = str + str2; str3 BIOJAVA C(ANSI C) 33
Bioinformatics in J a va C/C++ goto break(multilevel break) (label), break continue t e s t : for(int i=0; i<max1; i++) { for(int j=1; j<max2; j++) i f ( m a t r i x [ i ][ j ] = = 0 ) break test; } break test; break; j i, break, C/C++ C C++, 34
CHAPTER 02, (garbage collector), (error),,,, (exception) (exception handler) try/catch/finally try { // try } catch (exception type identifier) { // catch 1 } catch (exception type identifier) { // catch 2 } catch (exception type identifier) { // catch 3 } finally { } // finally try, try catch finally, try throw 35
Bioinformatics in J a va 6 (thread),, (flow of execution), (multi-thread), (heap) (stack), (code),,, Thread Thread worker = new Thread( ); start( ) workerstart( ); Thread start( ), run( ), run( ), run( ), Thread run( ) run( ) (, overriding) Thread Runnable 2 5, 36
CHAPTER 02 Artemis (Sanger Institute, http://wwwsangeracuk/), GenBank Artemis Artemis (http://wwwsangeracuk/software/artemis/v7/) 37
Bioinformatics in J a va Artemis, Artemis ActMain 25,,,,,,, 38
CHAPTER 02, Artemis 2 6,,, (DOS) 31, Solaris1x (JDK: JAVA Development Kit) JDK (http://javasuncom) 39
Bioinformatics in J a va JDK 50, JDK 50 26 Popular Download, http:// javasuncom/j2se/150/downloadjsp JDK 50 Update 4 - including the JVM Te c h n o l o g y Download JDK 50 Update 4 JDK 50 40
CHAPTER 02 JDK JDK(JAVA Development Kit), 41
Bioinformatics in J a va JDK Change, 42
CHAPTER 02 Next JDK (JRE: Java Runtime Environment) JRE Next 43
Bioinformatics in J a va Next, JRE JRE, JDK 44
CHAPTER 02 JDK, JDK PATH CLASSPATH JDK, PATH PATH D : \ J a v a \ j d k 1 5 0 _ 0 4 \ b i n 45
Bioinformatics in J a va, JDK javac, java 46
CHAPTER 02 FirstProgramjava, main( ) java javac java, UltraEdit-32, AcroEdit Eclipse, AcroEdit Eclipse UltraEdit-32, AcroEdit Eclipse 222 {, } 2 22,, (Integrated Development Environment) Forte for Java, (Borland) JBuilder (Oracle) JDeveloper, (WebGain) Visual Cafe, 47
Bioinformatics in J a va, AcroEdit Eclipse UltraEdit-32 2 7, 48
CHAPTER 02 The Java Tutorial (Essential Java Classes): http://javasuncom/docs/books/tutorial/essential/indexhtml Sun The Java Tutorial: http://javasuncom/docs/books/tutorial/ Sun Javanet : http://wwwjavanet/ Sun Developer Network: http://javasuncom/ JGuru: http://wwwjgurucom Javalobby: http://wwwjavalobbyorg/ Java World: http://wwwjavaworldcom/ JDK: http://javasuncom/j2se/150/downloadjsp Visual Cafe: http://wwwsymanteccom/ Visual J#: http://msdnmicrosoftcom/vjsharp/ J Builder: http://wwwborlandcom/us/products/jbuilder/indexhtml Kawa: http://wwwgnuorg/software/kawa/ EditPlus: http://wwweditpluscom/ Eclipse: http://wwweclipseorg/ 1 (a) (b),, (c) (d) GUI 49
Bioinformatics in J a va (e), / / (f),,, Thread, 2 3 4 5 50