1

JAVA PROGRAMLAMA DİLİ (1.1 SÜRÜMÜ)

ww w. ja
1

va

Dr. M. Turhan Çoban TÜBİTAK Marmara Araştırma Merkezi Enerji Sistemleri ve Çevre Araştırma Enstitüsü Email : turhan@mam.gov.tr

dil

i.c o

m

2

İNDEKS BÖLÜM 1 : JAVAYA GİRİŞ
1.1 Niçin Java programlama Dili 1.2 Java programını yazma ve çalıştırma 1.3 Java Programlama dili temel değişken türleri 1.3.1 Boolean değişken türü 1.3.2 char (harf) değişken türü 1.3.3 Tam sayı değişken türleri (byte, short,int,long) 1.3.4 Gerçek sayı değişken türleri (byte, short,int,long) 1.3.5 String değişkeni 1.4 Aritmetik işlemler 1.5 Javada Mantıksal işlemler 1.6 Java Dilinin temel komutları 1.6.1 if - elseif - else mantıksal karşılaştırma yapısı 1.6.2 while tekrarlama yapısı 1.6.3 for tekrarlama yapısı 1.6.4 switch - case yapısı

BÖLÜM 2 : METOTLAR VE OBJECT KULLANIMI

ww w. ja
2

BÖLÜM 3 : SINIF (CLASS) YAPILARINA GİRİŞ

3.1 Sınıf yapısının genel tanımı 3.2 Kurucu ( constructor ) metot 3.3 Diğer metotlar 3.4 this deyiminin kullanımı 3.5 sınıf değişkenlerinin dış dünyadan gizlenmesi 3.6 Sınıflarda Kalıtım (inheritance) 3.7 Sınıfları başka bir sınıfta nesne olarak çağırarak bir araya getirme (composition) 3.8 Kalıtım yoluyla alt sınıfa bağlanmış üst sınıf referansı üzerinden alt sınıfı çağırma 3.9 nesneyi dinamik olarak silmek finalize() metodu

BÖLÜM 4 : BOYUTLU DEGİŞKEN VE NESNELER (ARRAYS)
4.1 tek boyutlu değişkenler 4.2 tek boyutlu nesne tipi değişkenler 4.3 Çok boyutlu değişkenler 4.4 Boyutlu değişkenlerin metodlara aktarımı

va

2.1 Java API Kütüphanesi 2.2 Metotlar 2.3 Nesne (Object) tanımı ve metodlarda kullanımı 2.3 Metodların kendi kendini çağırması (Recusion) 2.4 Aynı adlı metodların bir arada kullanılması (overloading) 2.5 Metod (method) ve sınıf değişkenleri

dil

i.c o

m

3

5.1 Abstract sınıf 5.2 Interface

6.1 Graphics sınıfı 6.2 Renk kontrolü 6.3 Yazı Kontrolu 6.4 Çizgi çizimi 6.5 Dikdörtgen çizimi 6.6 Oval ve açılı oval çizimi 6.7 Polygon çizimi 6.8 Resim gösterimi

BÖLÜM 7: Grafik Applet Oluşturma Metotları, Grafik Kullanıcısı Arabirim programları (GUI)
7.1 Graphic Kullanıcısı Arabirim programları, GUI, (Graphics User Interface) 7.2 Label (Etiket) sınıfı 7.3 Button (Düğme) sınıfı 7.4 TextField(YazımAlanı) sınıfı 7.5 TextArea(YazımAlanı) sınıfı 7.6 Choice (Seçim) sınıfı 7.7 CheckBox ve CheckBoxGroup sınıfları 7.8 Mouse(Fare) kontrolu 7.8.1 FareTesti.java programı ve apleti 7.9 List sınıfı, listeden seçim 7.10 FlowLayout sınıfı kullanarak GUI formatlanması 7.11 BorderLayout sınıfı kullanarak GUI formatlanması 7.12 GridLayout sınıfı kullanarak GUI formatlanması 7.13 Panel sınıfı

ww w. ja
3

8. JAVADA HATA ANALİZİ VE YAKALANMASI 9. PARELEL KULLANIM (MULTITHREADING) 10. JAVA GİRDİ - ÇIKTI PROGRAMLANMASI

10.1 Javanın I/O (Girdi çıktı ) kütüphanesinde yer alan sınıflar ve interface’ler 10.2 File (Dosya) sınıfı 10.3 Ardışık (Sequential) dosya yaratılması 10.4 Raslantısal Ulaşım Dosyası Oku (Random Access File)

11 GELİŞMİŞ JAVA BİLGİ İŞLEME YAPILARI

va

dil

i.c o

BÖLÜM 6 : GRAFİKLER, FONTLAR VE RENKLER

m

BÖLÜM 5 : SINIFLARDA HİYERARŞİ, ABSTRACT SINIF VE İNTERFACE

4

11.1 Vector Sınıfı 12 ÖRNEKLERLE SAYISAL ANALİZ
EK A TEXT SINIFI EK B JAVA KÜTÜPHANESİ İNDEKSİ EK C JAVADA KULLANILAN METODLARIN LİSTESİ

ww w. ja
4

va

dil

i.c o

m

5

BÖLÜM 1 : Javaya Giriş
1.1 Niçin Java programlama Dili

ww w. ja
5

Mayıs 1995 de SUN javayı büyük bir konferansta tanıttı. Program iş dünyası tarafından derhal büyük bir ilgiyle karşılandı. Java Modern bilgisayar dünyasının ses, grafik işlem, haberleşme gibi ihtiyaçlarına cevap verebilen ve Ticari gayeler için hazırlanan bir Program dili olarak daha önceki bilgisayar dillerinin hiç birinin kapsayamadığı özellikleri içermekteydi. Bunun yanı sıra dil komut yapısı olarak C++ diline çok yakın olması da öğrenilmesini kolaylaştırıyordu. SUN Javayı "World Wide Web" de kullanmak isteyen herkese ücretsiz olarak sundu. Java internette yayınlanmasının ardından çok büyük bir patlama yaşadı. 1997 ye gelindiğinde dünyadaki bütün bilgisayar okullarında temel bilgisayar dili olarak gösterilmeye başlandı. Dünyada şu anda hala en çok kullanılan bilgisayar dili olan C++ dilinin yapılan hataları tam olarak denetlememesi programın çalışma hızını arttırma yönünden iyi bir özellik olsa da profesyonel programcılar dışında kullanılmasını sınırlandırıcı bir etki yapıyordu. Java ise bütün hataları bildiren yapısı ve modern bilgisayarın bütün fonksiyonlarına ulaşabilen kütüphaneleriyle programcıların çok daha kolaylıkla öğrenebileceği bir dildir.

Javanın diğer önemli bir temel özelliği Nesne kökenli (object oriented) bir dil olmasıdır. Nesne kökenli diller, nesneleri gerçek dünyadakine daha benzer bir yapıda tanımlayarak anlaşılmalarını kolaylaştırırlar. Nesneleri gerçek dünyadaki gibi masa, sandalye, bilgisayar, gerçek gaz, ısı eşanjörü gibi tanımlayarak programlamak insan beyninin anlaması açısından çok daha kolaydır. Bundan önceki tam nesnel kökenli programlama dillerinden hiçbiri çok yaygınlık kazanmamıştı. Bu tür dillere Smalltalk,u Örnek verebiliriz. C++ nesnel kökenli programlama yapabilen bir dildir. Fakat yapısal (structural) bir programlama dili olan C dilinin bir uzantısı olarak geliştirildiğinden tam anlamıyla nesnel kökenli bir dil olduğu söylenemez.

Java dilini geleceğin dili yapan diğer bir özelliği de çok kullanımlı (multi-tasking) ve paralel kullanımlı(multi-treading) bir dil olmasıdır. Çok kullanımlılık birden fazla işlemin aynı anda yapılabilmesinin tanımıdır. Paralel kullanımlılık ise birden fazla programın aynı anda hafızayı beraber kullanarak kullanılabilmesidir. Örnek olarak World ve Excel programlarının Windows NT ortamında aynı anda kullanılmasıdır. ADA gibi bazı eski Program dillerinde

va

dil

Java Programlama dili şu anda dünyadaki en popüler programlama dillerinden biri haline gelmiştir. Java SUN bilgisayar şirketince orijinal olarak elektrikli ev araçlarının birbiriyle haberleşmesini sağlamayı amaçlayan bir proje içerisinde 1991 yılında geliştirilmeye başlandı. Orijinal adı bu dilin yaratıcısı James Gosling tarafından Oak olarak konulan programlama dili daha sonra bu isimde başka bir programlama dili olduğu keşfedilince o anda bir kahvehanede kahve içen programlama gurubu tarafından kahve markasından esinlenerek Java olarak değiştirildi. Akıllı elektronik ev araçları pazarı SUN gurubunun tahminlerinden çok daha yavaş bir gelişme gösteriyordu. Bu yüzden Java dili projesi ticari bir geliştirme projesi olarak büyük olasılıkla iptal edilecekti. 1993 Yılında "World Wide Web" büyük bir atılım göstererek bütün dünyaya yayılmaya başladı. Javanın Dinamik Web sayfaları hazırlamadaki büyük potansiyelini gören SUN şirketi projeyi bu tarafa yönlendirdi ve bu javaya yeni bir canlılık ve yaşama umudu sağladı.

i.c o

m

JAVA PROGRAMLAMA DİLİ

6

Javayı önemli bir Program dili haline getiren önemli özelliklerinden biri de kullanılan bilgisayardan bağımsız olmasıdır. Javada yazılan bir Program Unix, Machintosh, Windows 95 veya Windows NT veya herhangi bir 32 bit makinada hiç değiştirilmeden kullanılabilir. Java programlarının grafikleri "Wold Wide Web" sayfalarının programlama dili olan html (hypertext markup language) ile aktarılır. Bu yüzden html ve java programlarını birlikte kullanmak ve java programlarını gerçek zamanda www sayfalarında göstermek mümkündür. Kendi web sayfanızı veya webde yazılmış kitabınızı bütün dünyaya aktarırken yaptığınız analizleri de bu kitabın dinamik bir parçası olarak sunabilirsiniz. Bu Türkiye gibi ülkelerin dünyaya kapılarını daha kolay açmaları açısından oldukça önemli bir özelliktir.

Her programda olduğu gibi java programlarında da ilk evre programı yazmaktır. Java programları her editör programıyla yazılabilirler. Örneğin Unix sistemlerinde vi veya emacs, windows 95 ve windows NT de DOS Edit, veya Windows Notedefteri programları kullanılabilir. programı direk içinde yazıp çalıştırabilen Microsoft Visual J++, Symantec Visual Café, JPad gibi Java geliştirme paketleri de mevcuttur. Şüphesiz programı yazmadan önce Java compilerının bir kopyasını edinmeniz de gerekir. Java geliştirme seti (Java Developers kit - JDK) SUN bilgisayar şirketinin http://www.java.sun.com veya http://www.javasoft.com internet adreslerinden bedava çekilebilir. Çekme zahmeti çekmek istemiyorsanız SUN bu programları CD formatında da satmaktadır.

ww w. ja
javac isim.java
6

Java programı isim.java seklinde editörle yazılır. Java programınız yazıldıktan sonra ilk step java derleyici (compiler) programıyla isim.class ara bilgisayar kodunu oluşturmaktır. Java programını yazarken dikkat etmeniz gereken diğer bir özellik de javanın nesne sınıfının ismiyle dosyadaki isminin aynı olmasıdır. Bilgisayar konsol ekranında (DOS veya UNIX Console)

Komutunu bilgisayara gönderdiğinizde programınızda hata yoksa java derleyicisi isim.class dosyasını yaratır. Eğer programınızda hata varsa hataların listesini verir. Editör programına geri dönüp hataları düzeltmeniz ve sonra bu komutu tekrar denemeniz gerekecektir. Java programları iki ortam için yaratılabilir. Birincisi Konsol ortamıdır (DOS, Unix console gibi). İkincisi ise Pencere (Applet) ortamıdır. Eğer Program konsol ortamında yazılmışsa java isim komutu kullanılarak sonuçlar ekranda görülebilir. Eğer Program applet ortamında yazılmışsa html diline isim.html dosyası açılır. En basit şekilde html dosyası şu şekilde tanımlanabilir :

va

dil

1.2 Java programını yazma ve çalıştırma

i.c o

m

çok kullanımlılık programlanabiliyordu. Paralel kullanım olanaklarını sunan ilk bilgisayar dili ise javadır. Paralel kullanım paralel programlama kavramından ayrıdır ve karıştırılmamalıdır. Paralel programlanmada birden fazla Bilgi işlem Ünitesine (CPU ) ayrı programlar veya bir programın ayrı parçaları gönderilir. Paralel kullanımda ise bir CPU nun kullanım zamanı küçük parçalara ayrılarak değişik Program veya Program parçacıkları bu zaman paketçiklerini paylaşarak kullanırlar.

7

Aşağıdaki listede ilk konsol programımız Hosgeldiniz.java görülmektedir. Listedeki satır numaraları (1:) programın bir parçası değildir. Sadece programların izlenmesini kolaylaştırmak amacıyla verilmiştir. 1: import java.io.*; //java girdi cikti sinifini cagir 2: 3: class Hosgeldiniz 4: { 5: public static void main(String args[]) 6: { 7: System.out.println("Java Sinifina Hos Geldiniz!"); 8: } 9: } Şekil 1.2.1 Hoşgeldiniz.java konsol programı bu programı çalıştırmak için javac Hosgeldiniz.java java Hosgeldiniz

ww w. ja
Java Sinifina Hos Geldiniz! Yazısını alırız.
7

komutlarını konsolda vermemiz yeterlidir konsol çıktısı olarak:

Şimdi bu programdaki satırlara tek göz atalım. import java.io.*; Bu deyim java konsol girdi çıktı kütüphanesindeki metodları programımıza aktarır. //java girdi cikti sinifini cagir // işaretiyle başlayan yazılar bilgisayar tarafından kullanılamaz sadece programı okuyanı bilgilendirmek amacı taşır /* ..... */ işaretleriyle de verilebilir. Örneğin :

/* Bu kısımda yazılanlarla bilgisayar ilgilenmez Sadece insanların programı anlaması içindir */

class Hosgeldiniz Class (sınıf) nesne kökenli programlama yapısının temel taşıdır. Her Class'ın kendine özgü bir ismi olması gerekir. Daha önce yazılmış Class'lar import deyimiyle

va

dil

i.c o

daha sonra bu dosya konsoldan appletviewer isim.html komutuyla çalıstırılabilir. Yahut herhangi bir browser programına yüklenerek görülebilir.

m

<html> <applet code="isim.class" wıdth=200 heıght=50> </applet> </html>

8

{ } başlatma ve bitirme : Tüm Program parçacıkları { işaretiyle başlar ve } işaretiyle son bulur.

System.out.println("Java Sinifina Hos Geldiniz!"); Bu satır System.out sınıfından println metodunu alıştırır. Bu metot method girişinde gönderilen String tipi değişkeni konsol çıktısına aktarır. Fortran dilindeki write(*,*) veya print*, c dilindeki scanf, c++ dilindeki cout<< terimlerinin javadaki tam karşılığıdır. İlk applet programımız HosgeldinizApplet.java listesi Şekil 1.2.2 de verilmiştir 1: import java.applet.Applet; 2: import java.awt.*; 3: 4: public class HosgeldinizApplet extends Applet 5: { 6: public void paint(Graphics g) 7: { 8: g.drawString("Java sinifina hos geldiniz!",25,35); 9: } 10: } Şekil 1.2.2 HosgeldinizApplet.java programı bu programı çalıştırmak için

ww w. ja
javac HosgeldinizApplet.java appletviewer HosgeldinizApplet.html
8

komutlarını konsolda vermemiz yeterlidir. Ebette HosgeldinizApplet.html dosyasının yukarıda belirtildiği gibi hazırlanmış olması da gerekir. Fakat Konsol programlarından farklı olarak sonucu konsol yerine Applette görürüz. Aynı sonucu appletviewer deyimini kullanmadan bir browser programı çağırarak da elde edebiliriz. Çıktı görüntüsü aşağıdaki gibi olacaktır.

va

dil

i.c o

public static void main(String args[]) diğer dillerde fonksiyon (function), subroutine, procedure gibi adlarla anılan Program parçacığının başlığı. Bu Program parçacıkları javada Metot (Method) adıyla anılır. Metotların girdileri ve çıktıları olabilir. Bu metodun adı main (ana Program) dır. String değişken türü args[] değişkeni girdi olarak girebilir. Bu methotta void çıktı türü kullanılmıştır. Void kelimesi bu methotdan hiçbir çıktı alınmayacağını belirtir. public metoda dışarıdan ulaşılabilme izni verir.

m

programa çağırılabilirler. Yeniden yazılmaları gerekmez. Class yapısı e tanımlamaları üzerinde daha sonraki bölümlerde çok daha detaylı bilgi verilecektir.

9

Bu programında temel olarak bazı farklılıklar dışında bir önceki programa benzediğini gözlemleyebiliriz. import java.applet.Applet; import java.awt.*; deyimleri java kütüphanesindeki Applet ve pencere(awt) sınıf programlarını programımıza aktarır. public class HosgeldinizApplet extends Applet deyimi HosgeldinizApplet isimli sınıfı (class) yaratır. Bu sınıf tüm Applet sınıfının bir devamı olarak tanımlanmaktadır (extends Applet) diğer bir deyimle Applet sınıfının bütün metotları extends deyimiyle HosgeldinizApplet sınıfımızın içine kopyalanmıştır. public void paint(Graphics g) deyimi appletin grafik olarak çizilmesini sağlar. Bu Metot Graphics sınıfı g nesnesini girdi olarak kullanır. Metodun çıktısı yoktur.

ww w. ja
9

1.3 Java Programlama dili temel değişken türleri Programlama dillerinde rakamlar bilgisayar belleğinin temel depolama birimlerine yazılırlar. Temel bilgisayar bellek birimi bit olarak adlandırılır. Bir bilgisayar belleğindeki tek bir transistörden oluşmuştur. Bu transistörden akım geçiyorsa tansistörün veya bitin bellek değeri 1 (bir) veya true (doğru) olarak alınır. Eğer akım geçmiyor veya düşük düzeyde bir akım geçiyorsa transistörün bellek değeri 0 (sıfır) veya false(yanlış) olarak alınır. Bilgisayar bit birimleri bir araya gelerek bilgisayar temel değişken türlerini yazabileceğimiz bir sistem oluştururlar. Değişken türü bilgisayar tarafından bilinmelidir, çünkü aynı bit topluluğu bir harfi simgeleyebileceği gibi bir rakamı da simgeleyebilir. Java dilinde Şekil 1.3.1 de görülen değişken türleri mevcuttur . Şimdi bu değişken türlerinin bazılarını daha detaylı inceleyelim: 1.3.1 Boolean değişken türü Boolean değişken türü mantık işlemlerinde kullanılır. Sadece true veya false değerleri alır. True doğru false yanlış anlamı taşır. Mantık değişkenlerine doğrudan true veya false değerleri yüklenebileceği gibi diğer değişkenleri mantık işlemlerini kullanarak karşılaştırarak ta değerleri programların içinde hesaplanabilir. Değişken Türü Türkçe karşılığı Bit Sınır Değerleri büyüklüğü boolean Mantık değişkeni 1 true(doğru) , false(yanlış) char harf değişkeni 16 '\u0000' den '\uFFFF' byte tam sayı değişkeni 8 -128 den 127 e short tam sayı değişkeni 16 -32768 den 32767 e int tam sayı değişkeni 32 -2157483648 den 2147483647 e long tam sayı değişkeni 64 -9223372036854775808 den 9223372036854775808 e float Gerçek sayı değişkeni 32 -3.40292347e+38 den 3.40292347e+38 e double Gerçek sayı değişkeni 64 -1.7976931348623157e+308 den 1.7976931348623157e+308 e Şekil 1.3.1 Java Temel Değişken türleri

va

dil

g.drawString("Java sinifina hos geldiniz!",25,35); Bu terim Appletin x = 25, y=35 noktasına Java sinifina hos geldiniz! Yazısını çizer. DrawString Grafik sınıfı g nesnesine ait bir metotdur.

i.c o

m

10

ww w. ja
char A1,A2; char alpha1,alpha2; A1='\u0041'; A2='A'; alpha1='\u03E1'; alpha2='a';

ISO Unicode da tanımlanan '\u0041' kodu 'A' harfi anlamına gelir. Veya '\u03E1' kodu 'a' harfini tanımlar. ISO Unicode karakter setinin ilk iki rakamı sıfır olduğunda ASCII karakter koyunu tanımlar. Unicode hakkında daha ayrıntılı bilgi için http:\\unicode.org internet adresini ziyaret edebilirsiniz. Aşağıdaki küçük program parçacığı char tipi A1, A2 ve alpha1,alpha2 değişkenlerine A ve a harflerini yüklemektedir.

Burada şunu kaydedelim alpha1 değişkenini her ortamda doğru olarak görebiliriz, fakat alpha2 değişkeni bazı ortamlarda görülmeyebilir. 1.3.3 Tam sayı değişken türleri (byte, short,int,long)

Tam sayı değişkenler hafızada işgal ettikleri yere göre byte(8 bit), short(16 bit), int(32 bit) ve long(64 bit) adını alırlar. Bir bitlik hafızaya sadece iki rakamın (0 veya 1) yazılabileceği göz önüne alınırsa örneğin sekiz bitlik byte türü tamsayı değişkenine 256 sayı (ikili sayı eşiti

va
10

boolean ilkmantıkdegiskeni; ilkmantikdegiskeni=true; 1.3.2 char (harf) değişken türü char değişken türü harflerin tanımlanmasında kullanılır. Harfler java dilinde ISO Unicode kodu ile bilgisayara aktarılır. Unicode 4 hekzagonal (16 tabanlı) sayının bir araya gelmesiyle oluşur. Hekzagonal sayı sisteminin onlu ve ikili sayı sistemiyle eşitliği şöyledir : Heksagonal Onlu İkili 0 0 0000 1 1 0001 2 2 0010 3 3 0011 4 4 0100 5 5 0101 6 6 0110 7 7 0111 8 8 1000 9 9 1001 A 10 1010 B 11 1011 C 12 1100 D 13 1101 E 14 1110 F 15 1111

dil

i.c o

m

Aşağıdaki küçük program parçası mantık değişkeni ilk mantık değiskeni'ni tanımlamakta ve doğru değerini bu değişkene yüklemektedir.

11

int ilktamsayi; ilktamsayi=32;

bu iki satırlık program parçacığı tek bir satır olarak int ilktamsayi=32; şeklinde de yazılabilirdi.

1.3.4 Gerçek sayı değişken türleri (byte, short,int,long)

Gerçek sayı sistemleri de 0 ve 1 bitleri kullanılarak oluşturulabilir. Gerçek sayıların tamsayıdan küçük kısımları 2 li tabanda eksi üstler kabul edilerek oluşturulur. Örnek olarak 16 bitlik gerçek bir sayıyı ikili sistemdeki bilgisayar belleğinde şu şekilde gösterebiliriz : + \ - 24
16

23
8

22
4

21
2

20
1

dil
2-1
0.5

2-2

i.c o
2-3 2-4 +\- 24
16

0.25

0.125

00.065

ww w. ja
Double ilkgerçekdegisken; ilkgerceldegisken=22.625e-7; 1.3.5 String değişkeni

Yukarıda 16 bitle temsil edilen sayı : +16+4+2+0.5+0.125)*10-(6+1) = 22.625e-7 rakamıdır. Gerçek sayı değişkende yeterli hassasiyeti sağlayabilmek için genelde 64 bit uzunluğundaki double değişken türü kullanılır. Javadaki Matematik kütüphaneleri de double değişken türü için tanımlanmıştır. Aşağıdaki küçük program parçacığında double türü ilkgercekdegisken değişkenine 22.625e-7 sayısını yüklüyoruz.

String değişkeni yazı yazdırma işleri için kullanılır. Aslında temel değişken türlerinden değildir. Java dilinde char değişken türü kullanılarak tanımlanmış bir nesne tipi değişkendir. Aşağıdaki küçük program parçacığında bu değişken tütünün kullanılmasını görüyoruz. String a="ali"; String c="veli"; String d; d=a+b; // d nin değeri "ali veli" System.out.println(d); // bu satır ali veli çıktısı verir

String türü sabitler her zaman " işaretleri arasına yazılırlar ve + işaretiyle bir araya getirilebilirler.

va
11

0

1

0

1

1

0

1

0

1

0

1

m
23
8

11111111) yazılabileceği ortaya çıkar. Bitlerden biri + veya - işareti için kullanıldığından byte değişkeninin sınır değerleri -128den 127 e kadardır (toplam 256 sayı). Eğer bir tamsayı değişkenin sadece artı değerlerini kullanmak istersek unsigned terimini kullanırız. Örneğin unsigned byte tipi tamsayı değişkenin sınır değerleri 0 dan 256 ya kadardır. Tamsayı değişken türleri içinde en fazla kullanılan int türüdür. Aşağıdaki küçük program parçacığında int türü ilktamsayi değişkenine 32 rakamı yüklenecektir.

22
4

21
2

20
1

1

0

0

0

1

12

1.4 Aritmetik işlemler Javadaki temel aritmetik işlemler şunlardır : + toplama - çıkarma * çarpma / bölme % tamsayılar için bölmede kalan (modül)

Şekil 1.4.1 deki program örneği int tamsayı kullanarak bu aritmetik işlemlerin yapılmasını göstermektedir. 1: import java.io.*; //java girdi cikti sinifini cagir 2: 3: class Aritmetik 4: { 5: public static void main(String args[]) 6: { 7: int sayi1,sayi2; 8: int toplama,cikarma,carpma,bolme,kalan; 9: sayi1=2; 10: sayi2=3; 11: toplama = sayi1+sayi12; 12: cikarma = sayi1-sayi2; 13: carpma = sayi1*sayi2; 14: bolme=sayi1/sayi2; 15: kalan=sayi1%sayi2; 16: System.out.println("sayi1 + sayi2 ="+toplama); 17: System.out.println("sayi1 - sayi2 ="+cikarma); 18: System.out.println("sayi1 * sayi2 ="+carpma); 19: System.out.println("sayi1 / sayi2 ="+bolme); 20: System.out.println("sayi1 % sayi2 ="+kalan); 21: } 22: } Şekil 1.4.1 Aritmetik.java konsol programı
sayi1 sayi1 sayi1 sayi1 sayi1 + * / % sayi2 sayi2 sayi2 sayi2 sayi2 =5 =-1 =6 =0 =2

ww w. ja
++ bir ilave et -- bir çıkar += sağ taraftaki rakamı ilave et -= sağ taraftaki rakamı çıkar *= sağ taraftaki rakamla çarp

Şekil 1.4.2 Aritmetik.java konsol programı çıktısı

Java ve C dillerinde temel aritmetik işlemlerinin yanı sıra bu işlemlerin kısaltılmış sembolleri de oldukça sık kullanılır. Bu işlemler :

va
12

dil

i.c o

m

13

int a=2; int c; c=a++; // a nın değeri 3 c nin değeri 2 Şekil 1.4.2 ++ işlemcisinin değişkenden sonra kullanılması int a=2; int c; c=++a; // a nın değeri 3 c nin değeri 3 Şekil 1.4.2 ++ işlemcisinin değişkenden önce kullanılması

a değişkeninin değeri başlangıçta 2 ise görüldüğü gibi hem ++a işleminde hem de a++ işleminde değeri 3 e çıkmaktadır. Ancak c değişkeninin değeri c=a++ işleminde 2 olarak kalırken (önce değeri yükle sonra arttır), c=++a işleminde 3 olmaktadır(önce arttır, sonra değeri yükle). ++ ve -- işlemleri genelde tam sayı değişkenler için kullanılır.

ww w. ja
sayi1+= : 3 sayi1-= : 1 sayi1*= : 2

import java.io.*; public class Aritmetik1 { public static void main(String[] args) { int sayi1=1; int sayi2=2; sayi1+=sayi2; System.out.println("sayi1+= : "+ sayi1); sayi1-=sayi2; System.out.println("sayi1-= : "+ sayi1); sayi1*=sayi2; System.out.println("sayi1*= : "+ sayi1); sayi1/=sayi2; System.out.println("sayi1/= : "+ sayi1);

} } Şekil 1.4.3 Aritmetik1.java aritmetik işlem örneği

va
13

Şekil 1.4.3 de aritmetik işlemleri gösteren bir program verilmiştir. Şekil 1.4.4 Bu programın sonuçlarını vermektedir. Programı basamak basamak takip ederek sonuçların doğruluğunu elde hesaplayarak kontrol edebilirsiniz.

dil

i.c o

++ ve -- işlemleri değişkenden önce veya sonra gelebilir. Bu iki şeklin değişken tek başlarına kullanıldığında bir farklılıkları yoktur, fakat ikinci bir değişkenle birlikte tek bir deyimde kullanıldıklarında ikinci değişkenin değeri değişir. Aşağıdaki iki program parçacığına göz atalım.

m

/= sağ taraftaki rakama böl %= sağ taraftaki rakama bölüp kalanını al işlemleridir.

14

1.5 Javada Mantıksal işlemler

Şekil 1.5.1 java dilindeki mantıksal işlemler

Mantıksal işlemleri pekiştirmek amacıyla Şekil 1.5.2 de bir örnek verilmiştir. Şekil 1.5.3 bu örnek problemin sonucunu vermektedir. Satır satır proğramı takip ederek sonucuları kontrol ediniz. import java.io.*; public class booleanvar { public static void main(String[] args) { boolean b1,b2; b1=true; b2=false; System.out.println("b1 : "+ b1+" b2 : "+b2); System.out.println("b1 && b2 "+ (b1&&b2) ); System.out.println("b1 || b2 "+ (b1||b2) ); int sayı1,sayı2; sayı1=1; sayı2=2; System.out.println("sayi 1 : "+sayi1); System.out.println("sayi 2 : "+sayi2); b1=(sayi1 > sayi2); System.out.println("sayi1 > sayi2 "+ b1 ); b1=(sayi1 < sayi2); System.out.println("sayi1 < sayi2 "+ b1 ); b1=(sayi1 == sayi2); System.out.println("sayi1 == sayi2 "+ b1 ); b1=(sayi1 >= sayi2); System.out.println("sayi1 >= sayi2 "+ b1 ); b1=(sayi1 <= sayi2); System.out.println("sayi1 <= sayi2 "+ b1 ); b1=(sayi1 != sayi2);

ww w. ja

va
14

dil

Mantıksal İşlemci && || > < == >= <= ! !=

Anlamı ve veya büyüktür küçüktür eţittir büyük ve eţittir küçük ve eţittir değildir eşit değildir

i.c o

Javadaki temel değişken türlerine bakarken boolean türü değişkenleri tanımlamıştık. Tam sayı ve gerçek değişkenlerin aritmetik işlemlerde kullanılabildiği gibi boolean değişkenler de mantıksal işlemlerde kullanılabilirler. Mantıksal işlem işlemcileri şunlardır :

m

sayi1/= : 1 Şekil 1.4.4 Aritmetik1 sınıfının sonuçları

15

} Şekil 1.5.2 Java mantıksal işlemleri örnek problemi booleanvar.java b1 : true b2 : false b1 && b2 false b1 || b2 true sayi 1 : 1 sayi 2 : 2 1 > 2 false 1 < 2 true 1 == 2 false 1 >= 2 false 1 <= 2 true 1 != 2 true

Ţekil 1.5.3 Java mantıksal işlemleri örnek problemini booleanvar.java'nın sonuçları 1.6 Java Dilinin temel komutları

1.6.1 if - elseif - else mantıksal karşılaştırma yapısı

Bu yapı proğramda karar mekanizmalarını oluşturmak için kullanılır. Temel yapısı : if( boolean değişken yada sabit) { boolean degişken veya sabitin değeri true olduğunda yapılan işlemler} else if( boolean değişken yada sabit) { boolean degişken veya sabitin değeri true olduğunda yapılan işlemler} else { yukardaki boolean değişken vede sabitlerin hiçbiri true değerine eşit değilse yapılacak olan işlemler} else if yapısı probleme göre istenilen sayıda olabilir. If ve else yapısı sadece bir tane olarak kullanılır. Küçük bir örnek programla bu yapının çalışmasını inceleyebiliriz. import java.io.*; // giris çikis import Text; // okuma sinifi

ww w. ja

class ifyapisi { public static void main (String args[]) throws IOException { double not; // DataInputStream cin=new DataInputStream(System.in);

va
15

Bilgisayar dillerinde değişkenlerden sonraki en temel yapı temel dil komutlarıdır. Şimdi bu komut yapılarına tek tek göz atalım.

dil

i.c o

m

System.out.println("sayi1 != sayi2 "+ b1 ); }

16

Ogrencinin notunu giriniz : 53 D Şekil 1.6.1.1 if yapısını gösteren ifyapisi.java programının çıktısı

Şekil 1.6.1.2 deki program parçası a degiskeninin degeri : true yazısını yazdıracaktır. boolean a=true; if(a) {System.out.println("a degişkeninin değeri : true");} else {System.out.println("a degişkeninin değeri : false");} Şekil 1.6.1.2 if yapısının boolean değişkeniyle kullanılması.

ww w. ja

if - elseif - else yapıları iç içe girmiş yapılar veya basit mantıkların && (ve), ||(veya) işlemleriyle bağlanmasıyla daha kompleks mantıksal şartlar oluşturulabilir. Şekil 1.6.1.3 de iç içe geçmis ve Şekil 1.6.1.4 de && terimiyle bağlanmış iki proğram parçacığı görüyorsunuz. double x = 7.0; double y = 3.0; if(x > 5) { if(y>5) { System.out.println("x ve y besten buyuktur.");} elseif(y==5) { System.out.println("x besten buyuktur ve y bese esittir.");} else { System.out.println("x besten buyuktur ve y besten kucuktur.");} } else

va
16

Bu programda öğrenci notu girdi olduğundan girilen nota göre bilgisayar A,B,C,D,E veya F notlarından birini verecektir. Bu ilk programımızda if ve else if parantezlerinin içinde direk olarak boolean sabit kullanılmıştır. Parantez içi boolean değişken de olabilir.

dil

} Şekil 1.6.1.1 if yapısını gösteren ifyapisi.java programı

i.c o

System.out.println("Ogrencinin notunu giriniz : "); not=Text.readDouble(cin); if( not >= 90) { System.out.println("A"); } else if(not >=75) { System.out.println("B"); } else if(not >=60) { System.out.println("C"); } else if(not >=50) { System.out.println("D"); } else if(not >=40) { System.out.println("E"); } else { System.out.println("F"); } }

m

17

} } Şekil 1.6.1.3 İç içe geçmiş if yapısı

Yukarıdaki roğram parçecıklarından da görebildiğimiz gibi her türlü kompleks mantığı bilgisayar programlarına aktarmamız mümkündür. İf-else if-else yapıları programlamada en çok kullanılan yapı taşlarıdır.

While en çok kullanılan tekrarlama yapılarından biridir. ( ) içindeki boolean terim true (doğru) olduğu sürece yeniden işlemi döndürür. Eğer programda boolean işlemi suçlandıracak bir ifade yoksa sonsuza dek veya program baţka bir metodla durdurulana dek devam eder. while( boolean değişken yada sabit) { boolean degişken veya sabitin değeri true olduğunda yapılan işlemler} örneğin :

ww w. ja
int sayı=2; while(sayı <= 1000) { sayı *= 2; } do

while(true) { System.out.println("Bu yazı surekli olarak tekrar edecektir");} yapısı sonsuz bir döngü oluşturur. Aşağıdaki program ise sayı 1000 den büyük veya 1000 e eşit olduğunda durur.

While tekrarlama yapısı bazen biraz daha farklı bir yapı içinde verilebilir. Aşağıda gösterilen bu yeni yapı, bir önceki while yapısına göre daha ender kullanılar.

va
17

1.6.2 while tekrarlama yapısı

dil

double x = 7.0; double y = 3.0; if(x > 5 && y> 5) { System.out.println("x ve y besten buyuktur.");} else if(x > 5 && y==5) { System.out.println("x besten buyuktur ve y bese esittir.");} else if(x>5 && y<5) { System.out.println("x besten buyuktur ve y besten kucuktur.");} else if(x< && y>5) { System.out.println("x besten kucuktur ve y 5 den buyuktur.");} else if(x < 5 && y==5) { System.out.println("x besten kucuktur ve y bese esittir.");} } } Şekil 1.6.1.4 && (ve) deyimiyle bağlanmış if yapısı

i.c o

m

{ if(y>5) { System.out.println("x besten kucuktur veya esittir ve y 5 den buyuktur.");} elseif(y==5) { System.out.println("x besten kucuktur veya esittir ve y bese esittir.");} else { System.out.println("x besten kucuktur veya esıttır ve y besten kucuktur.");

18

Şekil 1.6.2.1 de dowhile döngüsünün kullanıldığı bir dowhileApplet.java programı görülmektedir import java.awt.Graphics; import java.applet.Applet; public class dowhileApplet { public void paint(Graphics g) { int saydirici=1; int x=25; do { g.drawString(Integer.toString(saydırıcı),x,25); x += 15; } while(++saydirici <= 10); } } Ţekil 1.6.2.1 dowhileApplet.java

Bu program calıstığında appletviewer Şekil 1.6.2.2 deki sonucu verecektir.

ww w. ja
1.6.3 for tekrarlama yapısı Şekil 1.6.3.1 for tekrarlama yapısı

Şekil 1.6.2.2 dowhileApplet.class sınıfının aplletviewer daki görünümü

for tekrarlama yapısıgenellikle sayıları belli bir düzen içinde arttırmak için kullanılır. Genel yapısı Şekil 1.6.3.1 de gösterilmiştir.programlamadaki sayı saydırmaya dönük uygulamalarda en fazla kullanılan yapıdır.

for(baslangıç değerleri ; boolean değişken veya sabiti ; tekrarlama değişkeni artışı) { boolean değişken veya sabiti true (doğru) olduğunda yapılan işlemler }

va
18

dil

i.c o

m

{ boolean degişken veya sabitin değeri true olduğunda yapılan işlemler. Bu paranteze boolean değerinin ne olduğuna bakılmaksızın en az bir kere girilir } while( boolean değişken yada sabit)

19

foryapisi.java kompile edildiğinde 1 den 100 e sayilarin toplami : 5050 sonucunu verecektir.

import java.applet.Applet; // java applet sinifi import java.awt.Graphics; // Java grafik sinifi

ww w. ja

public class faizOraniApplet extends Applet { public void paint( Graphics g) { double ilkYatanPara=100e6;//yuz milyon lira double paraMiktari=ilkYatanPara; double faizOrani=0.85;//yuzde seksenbes int y=40; g.drawString("Yil",25,25); g.drawString("paraMiktari",100,25); for(int yil=1; yil<=10 ; yil++) { paraMiktari*=(1.0+faizOrani); g.drawString(" "+yil,25,y); g.drawString(" "+paraMiktari,100,y); // not: drawString terimi daima String turu // degiskenle baslamali veya string e donusturulmelidir. y+=15; } // for dongusunun sonu } // paint metodunun sonu } // faizOraniApplet sinifinin sonu Şekil 1.6.3.3 faizOraniApplet.java programı

Şekil 1.6.3.3 de yine for döngüsünün uygulaması konusunda bir örnek problem verilmiştir. Programı nasıl çalıştığını inceleyiniz. Ilk iki faiz oranını elde hesaplayınız. Programı çalıştırarak sonuçları kontrol ediniz. Program sonuçları Şekil 1.6.3.4 de listelenmiştir.
19

va

dil

i.c o

import java.io.*; class foryapisi { public static void main(String args[]) { int toplam=0; for(int sayi=1;sayi<=100;sayi++) { toplam+=sayi;} System.out.println("1 den 100 e sayilarin toplami : "+toplam); } } Şekil 1.6.3.2 foryapisi.java konsol proğramı

m

Şekil 1.6.3.2 de 1 den yüze kadar sayıların toplamını hesaplayan bir konsol programı verilmiştir.

20

1.6.4 switch - case yapısı

Switch case yapısı çeşitli alternatifler içeren bir tablodan seçme yapma türü işlerde kullanılır. Temel yapısı Şekil 1.6.4.1 de verilmiştir. switch( degişken ismi) { case değişkenin alacağı deger : bu değer oluştuğunda yapılacak işlemler break; // bu deyim döngünün bitmesini sağlar. case değişkenin alacağı başka bir değer : bu değer oluştuğunda yapılacak işlemler break; // bu deyim döngünün bitmesini sağlar. ................ default : eğer yukarıdaki case kutularından hiçbirine girilemediyse yapılacak işlemler break; } Şekil 1.6.4.1 switch - case yapısı

ww w. ja

Şekil 1.6.4.2 de verilen switchApplet.java proğramı switch deyiminin nasıl kullanıldığını göstemektedir. Switch yapısı şu ana kadar bahsedilen yapılar içinde en az kulanılanıdır.

import java.applet.Applet; // java applet sinifini cagir import java.awt.*; // java pencere kullanma sinifini cagir import java.awt.event.*; // java pencereyi dinleme sinifini cagir public class switchApplet extends Applet implements ActionListener { //sinif degiskenleri
20

va

dil

1.6.3.4 faizOraniApplet.html appletinin appletviewer browser programında görünümü

i.c o

m

21

ww w. ja

// girdi alanindaki olan olaylari dinleme metodu public void actionPerformed(ActionEvent e) { //ogrencinin notunu pencereden oku String not1=e.getActionCommand(); not=not1.charAt(0); showStatus(""); // sonuç bolgesindeki yazıyı sil kutugirdisi.setText(""); //kutudaki harfi sil switch(not) { case 'A': case 'a': ++Asayisi; break; case 'B': case 'b': ++Bsayisi; break; case 'C': case 'c': ++Csayisi; break; case 'D': case 'd': ++Dsayisi; break;

va
21

public void paint(Graphics g) { g.drawString("Her harf notun toplami : ",25,40); g.drawString("A : "+Asayisi,25,55); g.drawString("B : "+Bsayisi,25,70); g.drawString("C : "+Csayisi,25,85); g.drawString("D : "+Dsayisi,25,100); g.drawString("E : "+Esayisi,25,115); g.drawString("F : "+Fsayisi,25,130); }

dil

i.c o

Label kutubasligi; //Label sinifi degiskeni (nesnesi) kutubasligi TextField kutugirdisi;//Textfield sinifi degiskeni (nesnesi) kutugirdisi char not; int Asayisi=0,Bsayisi=0,Csayisi=0,Dsayisi=0,Esayisi=0,Fsayisi=0; // pencereyi baslatma metodu public void init() { kutubasligi=new Label("Ogrencinin notunu giriniz (A B C.. : "); add(kutubasligi);//kutubasligini pencereye yaz kutugirdisi=new TextField(5); add(kutugirdisi);//kutuyu pencereye yerlestir // kutuya yeni ilave edilecek komutlari bekle // her yeni komutta actionPerformed metodunu calistir. kutugirdisi.addActionListener(this); }

m

22

} Şekil 1.6.4.2 switch - case yapısı örneği switchApplet.java

ww w. ja
ALIŞTIRMALAR

JAVA PROGRAMLAMA DİLİ HAFTA 1

1. Notdefteri programını kullanarak Hosgeldiniz.java proğramını incele. Konsole (MS Dos) ortamında aşağıdaki komutları kullanarak calıştır : javac Hosgeldiniz.java java Hosgeldiniz import java.io.*; class Hosgeldiniz { public static void main (String args[]) System.out.println("Java Sinifina Hos Geldiniz!"); } }

va
{ 22

2. Notdefteri programını kullanarak HosgeldinizApplet.java proğramını incele. Yıne not defteriyle HosgeldinizApplet.html programını incele. Konsole (MS Dos) ortamında aşağıdaki komutları kullanarak calıştır: javac HosgeldinizApplet.java appletviewer Hosgeldiniz.html import java.applet.Applet;import java.awt.*;

dil

Şekil 1.6.4.3 switch - case yapısı örneği switchApplet.html appletinin sonuçlari

i.c o

case 'E': case 'e': ++Esayisi; break; case 'F': case 'f': ++Fsayisi; break; default: showStatus("yanlis not tanimlandi yeni bir not giriniz."); break; } // switch deyiminin sonu repaint();//pencereyi yeniden paint metoduna gore ciz }

m

23 public class HosgeldinizApplet extends Applet { public void paint(Graphics g) { g.drawString("Java sinifina hos geldiniz!",25,25); }}

3. Notdefteri programını kullanarak ikisayitopla.java proğramını incele. Konsole (MS Dos) ortamında aşağıdaki komutları kullanarak calıştır : javac ikitamsayitopla.java java ikitamsayitopla import java.io.*; //giris çikis import Text; class ikitamsayitopla { public static void main (String args[]) throws IOException { int sayi1,sayi2; int toplam=0; // DataInputStream cin=new DataInputStream(System.in); System.out.println("Bir tam sayi giriniz : "); sayi1=Text.readInt(cin); System.out.println("Ikinci bir tamsayi giriniz : "); sayi2=Text.readInt(cin); toplam=sayi1+sayi2; System.out.println("Iki tam sayinin toplami : "+toplam); } }

ww w. ja

import java.applet.Applet; // java applet sinifini cagirimport java.awt.*; // java pencere kullanma sinifini cagirimport java.awt.event.*; // java pencereyi dinleme sinifini cagir public class tamsayitoplaApplet extends Applet implements ActionListener { //sinif degiskenleri Label kutubasligi; //Label sinifi degiskeni (nesnesi) kutubasligi TextField kutugirdisi;//Textfield sinifi degiskeni (nesnesi) kutugirdisi int sayi; int toplam; // pencereyi baslatma metodu public void init() { kutubasligi=new Label("Bir tamsayi giriniz : "); add(kutubasligi);//kutubasligini pencereye yaz kutugirdisi=new TextField(10); add(kutugirdisi);//kutuyu pencereye yerlestir toplam=0; // kutuya yeni ilave edilecek komutlari bekle // her yeni komutta actionPerformed metodunu calistir. kutugirdisi.addActionListener(this); } // girdi alanindaki olan olaylari dinleme metodu public void actionPerformed(ActionEvent e)

va
23

4. Notdefteri programını kullanarak tamsayitoplaApplet.java proğramını incele. Yine not defteriyle tamsayitoplaApplet.html programını incele. Konsole (MS Dos) ortamında aşağıdaki komutları kullanarak calıştır : javac tamsayitoplaApplet .java appletviewer tamsayitoplaApplet.html

dil

i.c o

m

24 { //sayiyi pencereden oku Integer sayi1=new Integer(e.getActionCommand() ); sayi=sayi1.intValue(); // sayiyi okutma islemini asagidaki deyimle de yapabiliriz // sayi=Integer.parseInt( e.getActionCommand() ); toplam+=sayi; // veya toplam=toplam+sayi; repaint();//pencereyi yeniden paint metoduna göre ciz }

public void paint(Graphics g) { g.drawString("Su ana kadarki sayilarin toplami : "+toplam,25,50); } }

ww w. ja

import java.io.*; //giris çikis import Text; class dortArtiIslem { public static void main (String args[]) throws IOException { int sayi1,sayi2; // DataInputStream cin=new DataInputStream(System.in); System.out.println("Bir tam sayi giriniz : "); sayi1=Text.readInt(cin); System.out.println("Ikinci bir tam sayi giriniz : "); sayi2=Text.readInt(cin); System.out.println("Iki tam sayinin toplami : "+(sayi1+sayi2)); System.out.println("Iki tam sayinin farki : "+(sayi1-sayi2)); System.out.println("Iki tam sayinin carpimi : "+(sayi1*sayi2)); System.out.println("Iki tam sayinin bolumu : "+(sayi1/sayi2)); System.out.println("Iki tam sayinin kalani : "+(sayi1%sayi2)); // Matematik tipi degisken islemleri : // + : topla // : cikar // * : carp // / : bol // % : bolumun kalani // += : kendisi ve sag tarafindaki ile topla // sayi1+=3 ve sayi1=sayi1+3 ayni islemdir // -= : kendisinden sag tarafindakini cikar // sayi1-=3 ve sayi1=sayi1-3 ayni islemdir // *= : kendisi ve sag tarafindakini carp // sayi1*=3 ve sayi1=sayi1*3 ayni islemdir

va
24

5. Notdefteri programını kullanarak dortArtiIslem.java proğramını incele. Konsole (MS Dos) ortamında aşağıdaki komutları kullanarak calıştır : javac dortArtiIslem.java java dortArtıIslem

dil

i.c o

m

25 // /= : kendisini sag tarafindakine bol // sayi1/=3 ve sayi1=sayi1/3 ayni islemdir // %= : kendisini sag tarafindakine bol kalanini ver // sayi1%=3 ve sayi1=sayi1%3 ayni islemdir // ++ : kendisine bir ekle // sayi1++ ve sayi1=sayi1+1 ayni islemdir // ++ : kendisine bir ekle // ++sayi1 ve sayi1=sayi1+1 ayni islemdir // -: kendisinden bir cikar // sayi1-- ve sayi1=sayi1-1 ayni islemdir // -: kendisinden bir cikar // --sayi1 ve sayi1=sayi1-1 ayni islemdir boolean mantik1,mantik2; mantik1=true; // dogru mantik2=false;//yanlis System.out.println("dogru ve yanlis : "+(mantik1 && mantik2)); System.out.println("dogru veya yanlis : "+(mantik1 || mantik2)); mantik1=( sayi1 > sayi2 ); mantik2=( sayi1 < sayi2 ); // Boolean (mantik) tipi degisken islemleri : // > : buyuktur // < : kucuktur // == : esittir // >= : buyuk veya esittir // <= : kucuk veya esittir // ! : mantigi tersine cevirme // != : esit degildir // && : ve // || : veya mantik1=( sayi1 > sayi2 ); mantik2=( sayi1 < sayi2 ); System.out.println("sayi1 buyuktur sayi2 : "+mantik1); System.out.println("sayi 1 kucuktur sayi2 : "+mantik2); } }

ww w. ja

Bir tam sayi giriniz : 3 Ikinci bir tam sayi giriniz : 2 Iki tam sayinin toplami : 5 Iki tam sayinin farki : 1 Iki tam sayinin carpimi : 6 Iki tam sayinin bolumu : 1 Iki tam sayinin kalani : 1 dogru ve yanlis : false dogru veya yanlis : true sayi1 buyuktur sayi2 : true sayi 1 kucuktur sayi2 : false

6. Notdefteri programını kullanarak gercekSayiOrtalamaApplet.java proğramını incele. Yine not defteriyle gercekSayiOrtalamaApplet.html programını incele. Konsole (MS Dos) ortamında aşağıdaki komutları kullanarak calıştır : javac gercekSayiOrtalamaApplet .java appletviewer gercekSayiOrtalamaApplet.html import java.applet.Applet; // java applet sinifini cagir import java.awt.*; // java pencere kullanma sinifini cagir import java.awt.event.*; // java pencereyi dinleme sinifini cagir public class gercekSayiOrtalamaApplet extends Applet implements ActionListener { //sinif degiskenleri 25

va

dil

i.c o

m

26 Label kutubasligi; //Label sinifi degiskeni (nesnesi) kutubasligi TextField kutugirdisi;// Textfield sinifi degiskeni (nesnesi) kutugirdisi double sayi; // Gerçel degisken sayi double toplam; // Gerçel degisken toplam double carpim; // Gerçel degisken carpim double aritmetikOrtalama; // Gerçel degisken aritmetik ortalama double geometrikOrtalama; // Gerçel degisken geometrik ortalama int sayici; // tam sayi degisken toplam rakam sayisini sayici // pencereyi baslatma metodu // pencere ilk basladiginda // degiskenler buradaki degerleri alirlar public void init() { kutubasligi=new Label("Bir sayi giriniz : "); add(kutubasligi); kutugirdisi=new TextField(10); add(kutugirdisi); toplam=0; carpim=1.0; aritmetikOrtalama=0; geometrikOrtalama=0; sayici=0; kutugirdisi.addActionListener(this); } // girdi alanindaki olan olaylari dinleme metodu // Her yeni rakam girildiginde bu metod çagirilir public void actionPerformed(ActionEvent e) { sayici++; Double sayi1=new Double(e.getActionCommand() ); sayi=sayi1.doubleValue(); toplam+=sayi; // veya toplam=toplam+sayi; aritmetikOrtalama=toplam/sayici; carpim*=sayi; // veya carpim=carpim*sayi; geometrikOrtalama=Math.pow(carpim,(1.0/sayici));//carpimin koku kutugirdisi.setText(" ");//kutudaki rakami sil repaint();//pencereyi yeniden paint metoduna göre ciz }

ww w. ja

public void paint(Graphics g) { // drawString Metodundaki eksen sistemi // -----------------------> x ekseni // | // | // | // V y ekseni g.drawString("Su ana kadarki sayilarin toplami : "+toplam,25,50); g.drawString("Su ana kadarki sayilarin aritmetik ortalamasi : "+aritmetikOrtalama,25,65); g.drawString("Su ana kadarki sayilarin geometrik ortalamasi : "+geometrikOrtalama,25,80); } }

va
26

dil

i.c o

m

27

7. Notdefteri programını kullanarak bessayıtopla.java proğramını incele. Konsole (MS Dos) ortamında aşağıdaki komutları kullanarak calıştır : javac bessayıtopla.java java bessayıtopla import java.io.*; // giris çikis import Text; // okuma sinifi class bessayitopla { public static void main (String args[]) throws IOException { double sayi; double toplam=0; int saydirici=0; // DataInputStream cin=new DataInputStream(System.in); while( saydirici < 5) { System.out.println("Bir tam sayi giriniz : "); sayi=Text.readDouble(cin); toplam+=sayi; saydirici++; } System.out.println("sayilarin toplami : "+toplam); } }

ww w. ja
Bir tam sayi giriniz : 1 Bir tam sayi giriniz : 2 Bir tam sayi giriniz : 3 Bir tam sayi giriniz : 4 Bir tam sayi giriniz : 5 sayilarin toplami : 15.0

8. Notdefteri programını kullanarak StringDegisken.java programını incele. Konsole (MS Dos) ortamında aşağıdaki komutları kullanarak calıştır : javac StringDegisken.java java StringDegisken import java.io.*; //giris çikis sinifini cagir class StringDegisken public class StringDegisken { public static void main (String args[]) throws IOException { String s1,s2,s3,s4; int i1; String s; s1="Ali "; s2="Veli ";

va
27

dil

i.c o

m

28 s3="49"; s4=" Elli"; s=s1+s2+s3+s4; System.out.println(s); i1=49; s=s1+s2+i1+s4; System.out.println(s); } } Ali Veli 49 Elli Ali Veli 49 Elli

9. alıstırma 7 deki bessayi topla.java programini iyice anladiktan sonra birden yüze (100) kadar sayiların ortalamasini hesaplayan birdenyüzeOrtalama.java program ve sinifini (Konsole) yaz ve calistir. import java.io.*; // giris cikis import Text; // okuma sinifi

sayilarin toplami : 5050.0 sayilarin ortalamasi : 50.5

ww w. ja
JAVA PROGRAMLAMA HAFTA 2 UYGULAMA Hafta 2 yeni java dosyalari Aritmetik.java Aritmetik1.java booleanvar.java ifyapisi.java karsilastirmaApplet.java

//if deyiminin kullanimiimport java.applet.Applet; // java applet sinifini cagirimport java.awt.*; // java pencere kullanma sinifini cagirimport java.awt.event.*; // java pencereyi dinleme sinifini cagir public class karsilastirmaApplet extends Applet implements ActionListener { Label soru1; //kullaniciya birinci degeri girme sorusu sorar TextField girdi1; //birinci degeri girme kutusu Label soru2; //kullaniciya ikinci degeri girme sorusunu sorar TextField girdi2; //ikinci degeri girme kutusu int sayi1,sayi2; //girilen iki sayi

va
28

class birdenyuzeortalama { public static void main (String args[]) { double sayi=1; double toplam=0; while( sayi <= 100) { toplam+=sayi++; } System.out.println("sayilarin toplami : "+toplam); System.out.println("sayilarin ortalamasi : "+toplam/100.0); } }

dil

i.c o

m

29 //graphic kullanici baglantisindaki ilk degerleri tanimla public void init() { soru1=new Label("Bir sayi giriniz "); girdi1=new TextField(10); soru2=new Label("Ikinci bir sayi giriniz"); girdi2=new TextField(10); add(soru1); //soru1 yazisini applete cizer add(girdi1);//girdi1 kutusunu applete cizer add(soru2); //soru2 yazisini applete cizer girdi2.addActionListener(this); // soru2 den sonra girdi (return) tusunu bekler // girdi(return) tusundan sonra actionPerformed // metoduna gider add(girdi2); //girdi2 kutusunu applete cizer } // sonuclari applete yazdir public void paint(Graphics g) { g.drawString("Karsilastirma sonuclari : ",70,75); if(sayi1 == sayi2) g.drawString(sayi1+" == "+sayi2,100,90); if(sayi1 != sayi2) g.drawString(sayi1+" != "+sayi2,100,105); if(sayi1 < sayi2) g.drawString(sayi1+" < "+sayi2,100,120); if(sayi1 > sayi2) g.drawString(sayi1+" > "+sayi2,100,135); if(sayi1 <= sayi2) g.drawString(sayi1+" <= "+sayi2,100,150); if(sayi1 >= sayi2) g.drawString(sayi1+" >= "+sayi2,100,165); } // eger girdi(return) tusuna basildiysa bu // metodu cagir public void actionPerformed( ActionEvent e) { // sayi 1 i girdi kutusundan oku sayi1=Integer.parseInt(girdi1.getText()); // sayi 2 i girdi kutusundan oku sayi2=Integer.parseInt(girdi2.getText()); repaint(); }

ww w. ja
}

va
29

dil

i.c o

m

30

whileyapisi.java

ww w. ja
dowhileApplet.java foryapisi.java faizOraniApplet.java switchApplet.java Ödev problem 1

sayi sayi sayi sayi sayi sayi sayi sayi sayi

= = = = = = = = =

4 8 16 32 64 128 256 512 1024

Bu dosyaları çalıştır ve içeriklerini incele

bir java konsol programı (kilo.java) yazarak On kişilik bir sınıftaki kişilerin ağırlıklarını girdi olarak giriniz. Ağırlıkları 40 kg dan az olanları zayıf olarak, Ağırlıkları 40 kilo ile 80 kilo arasında olanları normal, Agırlıkları 80 kg in üstünde olanları sişman katagorisinde sınıflarsak her sınıfta kaç kişi olduğunu yazdırınız. Dosyanızın adı agirlik.java, sınıfınızın adı : agirlık olacaktır. Bilmediğiniz yapıları örnek problemleri inceleyerek öğrenebilirsiniz.

va
30

import java.io.*; //java girdi cikti sinifini cagir class whileyapisi { public static void main(String args[]) { int sayi=2; while(sayi<=1000) { sayi*=2; System.out.println("sayi = "+sayi); }//while yapisinin sonu } }

dil

i.c o

m

31 JAVA PROGRAMLAMA DİLİ HAFTA 3 Bu haftaki yeni java dosyaları YILDIZ~1 JAV 324 03/05/98

20:55 yildiz3forApplet.java

ww w. ja
YILDIZ~2 JAV 366 02/05/98

import java.awt.Graphics;import java.applet.Applet; public class yildiz1whileApplet extends Applet { public void paint(Graphics g) { int i=1; int x=15; while(i++ <= 11) //i degeri birden 11 a kadar degisir { g.drawString("*",x,x); x += 15; // x degeri her i icin 15 artiyor } } }

va
23:37 yildiz1whileApplet.java 31

dil

import java.awt.Graphics;import java.applet.Applet; public class yildiz3forApplet extends Applet { public void paint(Graphics g) { int x,y; for(y=15;y <= 150;y+=15) { for(x=15;x <= y;x+=15) { g.drawString("*",x,y); } } } }

i.c o

m

32

YILDIZ~3 JAV

404

02/05/98

23:36 yildiz2forApplet.java

ww w. ja
YILDIZ~4 JAV 698 03/05/98

import java.awt.Graphics; import java.applet.Applet; public class yildiz2whileApplet extends Applet { public void paint(Graphics g) { int i=1; int x=0;

va
32

import java.awt.Graphics;import java.applet.Applet; public class yildiz2forApplet extends Applet{ public void paint(Graphics g) { int i; int x=0; for(i=1;i <= 11;i++) //i degeri birden 11 a kadar degisir { x += 15; // x degeri her i icin 15 artiyor g.drawString("*",x,x); g.drawString("*",x,(180-x)); } } }

dil

i.c o
1:13 yildiz2whileApplet.java

m

33 while(i++ <= 11) //i degeri birden { x += 15; // x degeri her i g.drawString("*",x,15); g.drawString("*",15,x); g.drawString("*",x,165); g.drawString("*",165,x); g.drawString("*",x,x); g.drawString("*",x,(180-x)); } } } 11 a kadar degisir icin // x // x // x // x // // 15 artiyor lineer degisken y 15 15 y lineer de§isken lineer degisken y 165 165 y lineer de§isken \ ciz / ciz

ww w. ja

YILDIZ~5 JAV

import java.awt.Graphics; import java.applet.Applet; public class yildiz1forApplet extends Applet { public void paint(Graphics g) { int i; int x=25; for(i=1;i <= 10;i++) //i degeri birden 10 a kadar degisir { g.drawString("*",x,x); x += 15; // x degeri her i icin 15 artiyor } } }

va
366 02/05/98 33

dil
23:10 yildiz1forApplet.java

i.c o

m

34

KILO~1

JAV

556

02/05/98

13:18 kilo.java

ww w. ja
kilonuzu giriniz : 45 normal kilonuzu giriniz : 95 sisman PIAPPL~1 JAV 369 03/05/98

class kilo { public static void main (String args[]) throws IOException { double kilo; // DataInputStream cin=new DataInputStream(System.in); System.out.println("kilonuzu giriniz : "); kilo=Text.readDouble(cin); if( kilo <= 40) { System.out.println("zayif"); } else if( kilo>40 && kilo<80 ) { System.out.println("normal"); } else { System.out.println("sisman"); } } }

import java.awt.Graphics;import java.applet.Applet; public class piApplet extends Applet { public void paint(Graphics g) { int i; double pi=0; int artieksi=-1; for(i=1;i < 5000000;i++) { artieksi*=-1; pi+=4/(2.0*i-1.0)*artieksi; } 34

va

dil
21:27 piApplet.java

import java.io.*; // giris çikis import Text; // okuma sinifi

i.c o

m

35 g.drawString("pi : "+pi,25,25);

}

ALIŞTIRMALAR 1.

Java applet programı kullanarak aşağıdaki şekli applet de çizdiriniz : ********** ********* ******** ******* ****** ***** **** *** ** *

ww w. ja

import java.awt.Graphics;import java.applet.Applet; public class H3A1 extends Applet { public void paint(Graphics g) { int x,y; for(x=15;x <= 150;x+=15) { for(y=15;y <= x;y+=15) { g.drawString("*",x,y); } } } }

va
35

dil

i.c o

m

}

36

********** * * * * ********** import java.awt.Graphics; import java.applet.Applet; public class H3A2 extends Applet { public void paint(Graphics g) { int x,y; for(x=15;x <= 150;x+=15) { g.drawString("*",x,15); g.drawString("*",x,60); } for(y=15;y <= 60;y+=15) { g.drawString("*",15,y); g.drawString("*",150,y); } } }

ww w. ja
3.

java konsol programı kullanarak bir sayinin faktoriyelini hesaplayiniz.

n!=n*(n-1)*(n-2)….4.3.2.1

import java.io.*; import Text; class faktoriyel { public static void main(String args[]) throws IOException { long faktoriyel=1; DataInputStream cin=new DataInputStream(System.in); int faktoriyelsayi; System.out.println("Bir tamsayi giriniz:"); faktoriyelsayi=Text.readInt(cin); for(int sayi=1;sayi<=faktoriyelsayi;sayi++) { faktoriyel*=sayi;} System.out.println(faktoriyelsayi+" faktoriyel: "+faktoriyel); } }

va
4!= 4*3*2*1 3!=3*2*1
36

dil

i.c o

m

2.

Java applet programı kullanarak aşağıdaki şekli appletde çizdiriniz

37

Bir tamsayi giriniz: 4 4 faktoriyel: 24 4. Java konsol programı kullanarak asağıdaki formulü hesaplayınız

ww w. ja
37

Bir sayi giriniz: 3 exp(3.0) = 20.08553692318766 gercek exp(3.0) = 20.08553692318767

va

import java.io.*; import Text; class H3A4 { public static void main(String args[]) throws IOException { double faktoriyel=1; double x; double us=1; double exponent=1; DataInputStream cin=new DataInputStream(System.in); System.out.println("Bir sayi giriniz:"); x=Text.readDouble(cin); for(double sayi=1;sayi<=200;sayi++) { faktoriyel*=sayi; us*=x; exponent+=us/faktoriyel; } System.out.println("exp("+x+") = "+exponent); System.out.println("gercek exp("+x+") = "+Math.exp(x)); } }

dil

i.c o

ex = 1 + x /1! + x2 / 2! + x3 / 3! + x4 / 4! + .. not : e=2.7182818

m

38

2.1 Java API Kütüphanesi

Metod Abs(x) Ceil(x)

Tanım x değişekeninin mutlak değeri
türkçesi : Mutlak

ww w. ja
Floor(x) Cos(x) Sin(x) Tan(x) Acos(x) Asin(x) Atan(x) x degişkenini bir üst tamsayıya dönüştürür (türkçesi : tavan) x değişkenini bir alt tamsayıya dönüştürür. (türkçesi : taban) x in trigonometrik cosünisü (x radyan cinsinden tanımlanmıştır.) x in trigonometrik sinüsü (x radyan cinsinden tanımlanmıştır.) x in trigonometrik tanjantı (x radyan cinsinden tanımlanmıştır.) x in trigonometrik cosünisünün tersi (sonuç radyan cinsindendir) x in trigonometrik sinüsü (x radyan cinsinden tanımlanmıştır.) x in trigonometrik tanjantı (x radyan cinsinden
38

va

Gerçek problemlerin boyutları genelde birinci bölümde gördüğümüz problemlere göre çok daha büyüktür. Bu yüzden genelde programlar küçük parçalara bölünerek daha kolaylıkla anlaşılır şekle getirilmeye çalışılır. Buna böl parçala ve yönet tekniği de diyebiliriz. Bu küçük parçalara javada metot adi verilir. Java programları yeni metotları içeren java sınıflarıyla(class) java sınıf kütüphanelerinde yer alan metotların birleşmesinden oluşur. Java kütüphanesinde matematik işlemlerinden grafik, ses, giriş çıkış işlemleri, yanlış kontrolu gibi birçok konularda yazılmış metotlar mevcuttur. Java metotlar kolleksiyonu Java API Adini alir. Java sınıf kütüphanesi adi da verilir. Java API dosyalarındaki metodlarin sadece isimlerinin listesi yaklaşık 200 sayfa boyutunda bir liste tuttuğundan burada sadece yeri geldiğine programları kullanırken örneklerde gerekli API isimlerini göreceğiz. Şu ana kadar kullandığımız java programlarında java.applet, java.awt ve java.io API paketlerini kullandık. Java.applet paketi appletleri oluşturma, appletlere giriş çıkısları ve ses dosyalarını applet içerisinde çalıştırmayı sağlar. java.awt pencere(window) ortamındaki tüm programlama sınıflarını ve metodlarını içerir. Bu metodları ilerideki bölümlerde daha detaylı inceleyeceğiz. java.io paketi javaya dışarıdan(dosya,ekran v.b) bilgi giriş çıkışını ayarlar. Java dilinde en çok kullanılan API sınıfı Math sınıfıdır. Bu sınıf(class) java.lang paketinde yer alır. Java.lang paketi java programı açılırken otomatik olarak çağırılır. Bütün diğer paketler import deyimi kullanılarak programa ilave edilirler. Math sınıfında tanımlanan metodların bazıları Şekil 2.1 de listelenmiştir. Tablodaki x veya y değişkenleri double değişken türündendir. Math sınıfında(class) iki tane de sabit tanımlanmıştır. Bu sabitlerden birisi Math.PI 3.14159265358979323846 (pi) sayısına eşittir. Diğeri Math.E 2.7182818284590452354 (e) sayısına eşittir.

dil

i.c o
Örnek Math.abs(9.2) = 9.2 Math.abs(-9.2) = 9.2 Math.ceil(9.2) = 10 Math.ceil(-9.8) = -9 Math.floor(9.2) = 9 Math.floor(-9.8) = -10 Math.cos(1.0)=0.54030230568 Math.sin(1.0)=0.8414709840709 Math.tan(1.0)=1.557040724655 Math.acos(0.54030230568)=1.0 Math.asin(0.8414709840709)=1. 0 4.0*Math.atan(1.0)=3.14159265 359

m

BÖLÜM 2 : METOTLAR VE OBJECT KULLANIMI

39

Şekil 2.1.1 Math sınıfında(class) çalışan metotlardan bazıları

Ţekil 2.2 de Math sınıfındaki metodları kullanan Matematik1 sınıfını görüyoruz. Bu programın sonuçları şekil 2.3 de gösterilmektedir.
import java.io.*; // giris cikis import Text; // okuma sinifi

ww w. ja

class matematik1 { public static void main (String args[]) throws IOException { double x,y; // DataInputStream sinifi cin nesnesini tanimla DataInputStream cin=new DataInputStream(System.in); System.out.println("Bir gercek sayi giriniz : "); x=Text.readDouble(cin); System.out.println("Bir gercek sayi giriniz : "); y=Text.readDouble(cin); System.out.println("Statik Matematik kutuphanesi Math de "); System.out.println("en cok kullanilan metodlar :" ); // Math.abs(3.2)=3.2 Math.abs(-3.2)=3.2 System.out.println("Math.abs("+x+") = "+Math.abs(x)); // Math.ceil(9.2)=10 Math.ceil(-9.8)=-9 // Math.ceil(x) x den buyuk en kucuk tam say ya yuvarlar System.out.println("Math.ceil("+x+") = "+Math.ceil(x)); // Math.floor(9.2)=9 Math.floor(-9.8)=-10 // Math.floor(x) x den kucuk en buyuk tam say ya yuvarlar System.out.println("Math.floor("+x+") = "+Math.floor(x)); // Trigonometrik fonksiyonlar sin(x) cos(x) tan(x) x:radyan // Math.PI pi sayisi System.out.println("Math.PI = "+Math.PI); System.out.println("Math.sin("+x+") = "+Math.cos(x)); System.out.println("Math.cos("+x+") = "+Math.sin(x)); System.out.println("Math.tan("+x+") = "+Math.tan(x)); //Trigonometrik fonksiyonlar asin(y) acos(y) atan(y) // asin,acos,atan : radyan System.out.println("Math.asin("+y+") = "+Math.acos(y)); System.out.println("Math.acos("+y+") = "+Math.asin(y)); System.out.println("Math.atan("+y+") = "+Math.atan(y)); // Math.log(x) dogal logaritma (e) taban na gore // Math.E e sayisi = 2.718281828... System.out.println("Math.E = "+Math.E); System.out.println("Math.log("+x+") = "+Math.log(x)); // Math.pow(x,y) x in y inci kuvveti System.out.println("Math.pow("+x+","+y+" ) = "+Math.pow(x,y)); // Math.exp(x) Math.E=e=2.718281828.. in x inci kuvveti System.out.println("Math.exp("+x+" ) = "+Math.exp(x));

va
39

dil

i.c o

Log(x) Pow(x,y) Max(x,y) min(x,y) Random()

m

exp(x)

tanımlanmıştır.) e(2.7182818284590452354) nin x inci kuvveti e tabanına göre logaritma x in y inci kuvveti x ve y nin büyük olanı x ve y nin küçük olanı Raslantısal sayı (0 ile 1 arasinda)

Math.exp(1.0) =2.718281828459 Math.exp(2.0) =7.389056098931 Math.log(2.718281828459)=1.0 Math.pow(3,2)=9.0 Math.max(2.3,12.7)=12.7 Math.min(2.3,12.7)=2.3 Math.random() = 0 ila bir arasında her sayı çıkabilir

40

}

Şekil 2.1.3 mathematik1.java programının sonuçları 2.2 Metotlar

ww w. ja
Şekil 2.2.1 Genel Metot tanımı Örnek olarak aşağıdaki metodu verebiliriz :

Metotlar java programlarının ana parçalarıdır. Metodlar sınıfların(class) içinde yer alan küçük program parçacıklarıdır. Metodların çogunda değişken parametreler metodlar ve sınıflar arasında iletişimi sağlarlar. Ayrıca her metodun kendine özgü değişkenleri de vardır. Metod yapısının ana sebebi programları modüler hale getirmektir. Aynı zamanda aynı program parçacığının tekrarlanmasını önlemeyi de sağlar. Her metod çağrıldığı proğram parçacığına belli bir değişkeni aktarabilir. Metodların tanımlarında aktardıkları değişken türü tanımlanır. Eğer metod hiçbir değişken aktarmıyorsa void sözcüğüyle tanımlanır. Metodların genel tanımı aşağıdaki gibidir. Parantez içindeki terimler kullanılmıyabilir.
(public) (static) sınıf değişken türü sınıf ismi( sınıf değişken girdi listesi) { sınıf içinde geçerli degişken tanımları Metodun ana gövdesi return metod çıktı değişkeni }

va
40

Bir gercek sayi giriniz : 9.2 Bir gercek sayi giriniz : 0.6 Statik Matematik kutuphanesi Math de en cok kullanilan metodlar : Math.abs(9.2) = 9.2 Math.ceil(9.2) = 10.0 Math.floor(9.2) = 9.0 Math.PI = 3.141592653589793 Math.sin(9.2) = -0.9748436214041636 Math.cos(9.2) = 0.22288991410024764 Math.tan(9.2) = -0.22864171155902654 Math.asin(0.6) = 0.9272952180016123 Math.acos(0.6) = 0.6435011087932844 Math.atan(0.6) = 0.5404195002705842 Math.E = 2.718281828459045 Math.log(9.2) = 2.2192034840549946 Math.pow(9.2,0.6 ) = 3.7868028596424734 Math.exp(9.2 ) = 9897.129058743905 Math.sqrt(9.2 ) = 3.03315017762062 Math.max(9.2,0.6 ) = 9.2 Math.min(9.2,0.6 ) = 0.6

dil

i.c o

Şekil 2.1.2 Math sınıfında(class) çalışan metotlardan bazılarını gösteren Matematik1.java programı

m

// Math.sqrt(x) x in kare koku System.out.println("Math.sqrt("+x+" ) = "+Math.sqrt(x)); // Maximum - minimum functions // Math.max(x,y) Math.min(x,y) System.out.println("Math.max("+x+","+y+" ) = "+Math.max(x,y)); System.out.println("Math.min("+x+","+y+" ) = "+Math.min(x,y)); }

41

Bu metoddaki x ve y gerçek (double) değişkenleri metodun girdi değişkenleridir. z ve f değişkenleri metodun yerel değişkenleridir ve bu metod dışında tanımları yoktur. Metod f değişkeninin değerini çıktı olarak metodun dışina aktarmaktadır. Eğer yukarıdaki metod aynı sınıfın içindeki başka bir metotda veya main metodunda aşağıdaki gibi bir örnekte kullanılırsa double z = 2.5; double r ; int i = 3; r = metodornegi(i,z); System.out.println(“r = “+r); r = 34 sonucuna ulaşılır.

Şimdi aynı metodun dinamik metod olarak bir appletin içinde kullanılmasını görelim.
import java.io.*;

ww w. ja
public class metotornegi1 { // sayinin karesi static metodu public static double kare(double x) { return x*x; } }

public static void main(String[] args) throws IOException { double sayi; DataInputStream cin=new DataInputStream(System.in); System.out.println("Bir tam sayi giriniz : "); sayi=Text.readDouble(cin); System.out.println("girilen sayinin karesi : "+kare(sayi));

} Şekil 2.2.2 metotornegi2.java programında kare metodunun kullanılması

va
41

dil

i.c o

Public static double metotornegi(int x,double y) { double z = 3.5; double f ; f = z*x*x+y; return f; }

m

42

public class metodornegi2 extends Applet { double sayi=5; // Gercek degisken sayi // sayinin karesi dinamik metodu public double kare(double x) { return x*x; } public void paint(Graphics g) { g.drawString(sayi+"nin karesi = } }

"+kare(sayi),25,50);

Şekil 2.2.3 metotornegi2.java programında kare metodunun kullanılması Şekil 2.2.3 de tanımlanan public double kare(double x) metodu, public void paint(Graphics g) metodundaki g.drawString(sayi+"nin karesi = "+kare(sayi),25,50); işleminde çağırılmıştır. Bilgisayar kare(sayi) ifadesini gördüğünde metodun içine gider, orada tanımlanan tüm işlemleri yaptıktan sonra return kelimesinin karşısındaki işlemleri çağırıldığı yere geri iletir. Metodorneği1 java programında çağırılan kare(sayi) metodunda sadece sayının kendisiyle çarpımı return kelimesinin karşısına yazıldığından, kare(sayı) ifadesi sayı*sayı ifadesiyle eşdeğerdir. Burada kare metodundandaki değişken adının sayı değil x olarak verildiğini de burada not edelim. Sayı değişkeni metodun girişinde x degişkenine yüklenir. Gerekli işlemler metodda yapıldıktan sonra sadece metodun sonuçları return deyimiyle geri döner. 2.3 Nesne (Object) tanımı ve metodlarda kullanımı

ww w. ja

Birinci bölümde temel değişken türlerini (double,int,boolean v.b.) nasıl tanımladığımızı görmüştük. Nesne tipi proğramlamanın en önemli özelliği kendi değişken türlerimizi yaratabilmemizdir. İlerideki bölümlerde kendi değişken türlerimizi sınıf (class) yapısını kullanarak nasıl yaratacağımızı daha detaylı olarak inceleyeceğiz. Bu bölümde

va
42

dil

i.c o

m

import java.applet.Applet; import java.awt.*;

// java applet sinifini cagir // java pencere kullanma sinifini cagir

43

DataInputStream cin=new DataInputStream(System.in);

Terimi DataInputStream sınıfından(class) cin nesnesini tanımlar. Bu tanımı yaparken System.in nesnesini girdi olarak kullanır. Nesne(object) tanımı yaparken aynı metodlarda olduğu gibi değişken veya nesneleri girdi olarak tanımlamamız mümkündür. Yukarıdaki tanımda System.in nesnesini tanımda girdi olarak kullanmaktadır. Diğer bir örnek olarak yine daha önceki örnek problemlerde kullandığımız Label sınıfından(class) kutubasligi nesnesinin tanımını ve TextField sınıfından(class) kutugirdisi nesnesini gösterebiliriz. Label kutubasligi; //Label sinifi degiskeni (nesnesi) kutubasligi kutubasligi=new Label("Ogrencinin notunu giriniz (A B C.. : ");

TextField kutugirdisi;//Textfield sinifi degiskeni (nesnesi) kutugirdisi kutugirdisi=new TextField(5); Bu örneklerde de görüldüğü gibi Nesne tanımı şu şekilde yapılmaktadır: Sınıf (class) ismi nesne(object) ismi; nesne(object) ismi = new Sınıf (class) ismi(değişken veya nesne girdi listesi)

ww w. ja
import java.applet.Applet; import java.awt.*; class metodornegi3a { // sayinin karesi dinamik metodu public double kare(double x) { return x*x; } }

Nesne tanımını daha iyi anlamak için metotornegi2 sınıfını yazdığımız programı biraz değiştirerek metodornegi3 ve metodornegi3a sınıflarını olusturalım ve kare metodumuzu metodornegi3a sınıfına yerlestirelim.
// java applet sinifini cagir // java pencere kullanma sinifini cagir

public class metodornegi3 extends Applet implements ActionListener { double sayi=5; // Gercek degisken sayi metodornegi3a nesne1=new metodornegi3a(); public void paint(Graphics g)

va
43

dil

i.c o

m

nesnelerin program içindeki tanımlanmasına göz atalım. Daha önce tanımladığımız bazı applet programlarında nesne tanımları zaten geçmişti. Örneğin daha önceki programlarımızda bilgi okutmak için kullandığımız

44 { g.drawString(sayi+"nin karesi = }

}

Şekil 2.2.4 metotornegi3.java programında kare metodunun kullanılması

ww w. ja

class metotornegi4a { // sayinin karesi dinamik metodu public static double kare(double x) { return x*x; } }

public class metotornegi4 extends Applet { double sayi=5; // Gercek degisken sayi public void paint(Graphics g) { g.drawString(sayi+"nin karesi = "+ metodornegi4a.kare(sayi),25,50); } }

Şekil 2.2.5 metotornegi4.java programında static kare metodunun kullanılması

Görüldüğü gibi metodornegi4 sınıfında(class) kare metodu metodornegi4a.kare(sayi) olarak tanımlanmış ve ek bir nesne adresi kullanılmamıştır. Static olarak tanımlanan metodların kendikendine yeterli metodlar olaması gerekir. Yani içinde bulunduğu sınıfla veya baska sınıflarla direk olarak veri alışverişi olamaz. Girdileri sadece girdi parantezleri () arasinda verilen değişkenlerdir.dinamik metodlar ise kendi

va
44

import java.applet.Applet; import java.awt.*;

// java applet sinifini cagir // java pencere kullanma sinifini cagir

dil

Metodornegi3.java programında iki tane sınıf(class) yaratılmıştır. İlk sınıf metodornegi3a da kare metodu tanımlanmıştır. İkinci sınıf(class) metodornegi3 de ise metodornegi3a sınıfı nesne1 nesnesi tanımlanmış, ve kare metodu nesne1 nesnesi üzerinden nesne1.kare(sayi) olarak çağırılmıştır. Bu metod nesne1 nesnesi için bilgisayar belleğinde bir yer ayırır. Kare metodunu çağırırken bu yerin adresini kullanır. Metodornegi2.java programında kare(sayı) dogrudan kullanılmıştı. Çunku kare metodu aynı sınıfın(class) içinde tanımlanmıştı. Metodornegi3.java programında ise kare metodu ayrı bir sınıf(class) ta tanımlandığından yerinin tanımlanması gerekir. Bu bizim kendi odamızın yatak odasını tanımlarken sadece yatak odası dememizle baska bir evin yatak odasını tanımlarken Ahmet beyin evinin yatak odası dememiz gibidir. Metotlar statik olarak da tanımlanabilirler. Statik olarak tanımlanan metodlar nesne kullanılmadan direk olarak sınıf(class) adları kullanılarak çağırılabilirler.

i.c o

m

"+nesne1.kare(sayi),25,50);

45

Şekil 2.2.6 metotornegi6.java programında static kare metodunun tanımlanması

import java.applet.Applet; import java.awt.*; import metodornegi6;

// java applet sinifini cagir // java pencere kullanma sinifini cagir // metodornegi6 sınıfını çağır

ww w. ja
import java.io.*; import Text; class faktoriyel {

public class metodornegi7 extends Applet { double sayi=5; // Gercek degisken sayi metodornegi6 x=new metodornegi(); public void paint(Graphics g) { g.drawString(sayi+"nin karesi = "+ x.kare(sayi),25,50); } }

Şekil 2.2.7 metotornegi7.java programında kare metodunun metodornegi6 sınıfı x nesnesi üzerinden kullanılışı.

2.3 Metodların kendi kendini çağırması (Recusion)

Bazı problemlerin çözümünde bir metodun kendi kendini çağırması yararlı olabilir. Java bir metodun kendi kendini çağırmasına izin verir. Burada dikkatli olunması gereken nokta sonsuza kadar bu kendi kendine çağırılmanın engellenmesidir. Kendi kendini çağıran programlarda mutlaka bir döngü çıkış şartı tanımlanmalıdır.

Daha önceki alıştırmalarımızda faktoriyel sınıfı tanımlanmıştı. Önce bu programdaki faktoriyel hesabını ayrı metod haline dönüştürelim.

va
45

dil

class metotornegi6 { // sayinin karesi dinamik metodu public double kare(double x) { return x*x; } }

i.c o

Metodornegi3.java ve Metodornegi4.java programlarında iki sınıf(class) aynı dosyada yer almiştı. Her sinifi ayri bir dosyada da tanımlamak mumkündür. Bu yapıldığında diğer dosya import(ithal) terimiyle diğer programa aktarılır. Şekil 2.2.6 ve 2.2.7 de Şekil 2.2.5 de verilen programın iki ayrı dosyada yazılımını görüyoruz.

m

sınıfları ve diğer sınıflarla değişken aktarımı yapabilirler

değişik

yollardan

bilgi

ve

46

}

Şekil 2.3.1 Metod kullanılmadan faktoriyel hesaplayan faktoriyel.java programı
import java.io.*; import Text; class faktoriyel1 { public static long faktoriyel(int x) { long faktoriyel=1; for(int sayi=1;sayi<=x;sayi++) { faktoriyel*=sayi;} return faktoriyel; }

ww w. ja
import java.io.*; import Text; class faktoriyel2 { public static long faktoriyel(int x) { if( x <= 1 ) return 1; else return x * faktoriyel( x – 1); }

public static void main(String args[]) throws IOException { DataInputStream cin=new DataInputStream(System.in); int faktoriyelsayi; System.out.println("Bir tamsayi giriniz:"); faktoriyelsayi=Text.readInt(cin); System.out.println(faktoriyelsayi+" faktoriyel:" + faktoriyel(faktoriyelsayi)); } }

Şekil 2.3.2 for döngülü faktoriyel metodunu kullarak faktoriyel hesaplayan faktoriyel1.java programı İkinci olarak faktoriyeli kendi kendini çağıran proğram yardımcılığı ile hesaplayalım.

public static void main(String args[]) throws IOException { DataInputStream cin=new DataInputStream(System.in);

va
46

dil

i.c o

public static void main(String args[]) throws IOException { long faktoriyel=1; DataInputStream cin=new DataInputStream(System.in); int faktoriyelsayi; System.out.println("Bir tamsayi giriniz:"); faktoriyelsayi=Text.readInt(cin); for(int sayi=1;sayi<=faktoriyelsayi;sayi++) { faktoriyel*=sayi;} System.out.println(faktoriyelsayi+" faktoriyel: "+faktoriyel); }

m

47

Bir tamsayi giriniz: 4 4 faktoriyel:24

Şekil 2.3.3 kendi kendini çağıran (recursive) faktoriyel metodunu kullarak faktoriyel hesaplayan faktoriyel2.java programı Bu programı çalıştırdığımızda faktoriyel hesabı şu şekilde yapılacaktır : 5! 5 * 4! 4 * 3! 3 * 2! 2 * 1! 1 faktoriyel metodu 1 e ulastığında tekrar kendisini çağırmıyacağından geriye dogru yaptığı hesapları göndermeye başlıyacaktır. 1 (2*1!(=1)) = 2 (3 * 2!(=2)) = 6 (4*3!(=6))=24 (5*4!(24))=120 5!(=120) sonuç 120 olarak ana programa gönderilir. 2.4 Aynı adlı metodların bir arada kullanılması (overloading)

ww w. ja
import java.awt.Graphics; import java.applet.Applet;
{

Java aynı adlı metodların aynı sınıf içerisinda kullanılmasına izin verir. Aynı sınıfta(class) kullanılan metodların girdi değişkenlerinin değişken türlerinin veya değişken sayılarının farklı olması gerekir. Java aynı isimli ve ayni degişkentürlü iki metodu birbirinden ayıramaz. Örneğin Public double Ametodu(double Adeğişkeni) Ve Public double Ametodu(double Bdeğişkeni) Veya Public int Ametodu(double Cdeğişkeni) Java tarafindan ayırt edilemez Fakat Public double Ametodu(double Adeğişkeni) Ve Public double Ametodu(int Bdeğişkeni)

Java tarafından ayırt edilir ve birlikte aynı sınıfın (class) içinde yer alabilir. Eğer birbirinin tam olarak eşiti metotlar değişik sınıflarda yer alıyorsa bunun herhangi bir sakıncası yoktur. Bu ahmet beyin veya mehmet beyin değişik yatak odaları varsa ikisinin de yatak odalarındaki aynı eşyalar turunden tanımlanmaları bir karışıklık yaratmaz. Şekil2.4.1 de ayniisimliikimetod.java programı görülmektedir. Bu programda daha önceki programlarda da kullandığımız kare metodunu int ve double girdi değişkenleriyle iki kere aynı sınıfın içerisinde tanımlayacağız.

public class ayniisimliikimetod extends Applet

va
47

dil

i.c o

m
+

int faktoriyelsayi; System.out.println("Bir tamsayi giriniz:"); faktoriyelsayi=Text.readInt(cin); System.out.println(faktoriyelsayi+" faktoriyel:" faktoriyel(faktoriyelsayi)); } }

48

// void tipi paint metodu

// int tipi kare metodu int kare(int x) { return x*x; } // double tipi kare metodu double kare(double x) { return x*x; }
}

Şekil 2.4.1 ayniisimliikimetod.java programı

Şekil 2.4.2 ayniisimliikimetod.html programıyla ayniisimliikimetod.class ın gösterilmesi

ww w. ja
2.5 Metod (method) ve sınıf değişkenleri
import java.awt.Graphics; import java.applet.Applet;

Bu programda parantez içerisinde 7 (tamsayı) verildiğinde java tamsayi metodu kare(int x), 7.5(gerçek sayı) verildiğinde gerçeksayi metodu kare(double x) i çağırır.

Metodların içinde kullanılan değişkenler sadece metodlara aittir. O metodun dışında tanımları yoktur. Eğer değişkenler metodların dışında sınıf(class) değişkenleri olarak tanımlanırsa metoda da aynen aktarılırlar. Sınıf değişkeniyle aynı isimde bir değişken mettotta da tanımlanmişsa bu değişken metodun içinde kullanılan metodun degişkenidir

public class metotvesinifdeg extends Applet { //buradaki değişkenler tüm sınıfa aittir double x ; int y ; void metod1( Graphics g) //metoda hi‡ bir de§iŸken girmiyor { x=5.5;

va
48

dil

i.c o

m

public void paint( Graphics g) { g.drawString(“ 7 nin karesi = “+kare(7),25,25); g.drawString( 7.5 un karesi = “+kare(7.5),25,40); }

49

}

Şekil 2.5.1 metodvesinifdeg.java programında metod değişkenlerinin sınıfa aktarılması Metod1 in disi : x=2.5 y=3 Metod1 in ici : x=5.5 y=6 Metod1 in disi : x=5.5 y=6 Şekil 2.5.2 metodvesinifdeg.java programının sonuçları

import java.awt.Graphics; import java.applet.Applet;

ww w. ja
}

void metod1( Graphics g) //metoda hi‡ bir de§iŸken girmiyor { double x; int y; x=5.5; y=6; g.drawString("metod1 in ici : x = "+x+" y = "+y,25,40); } public void paint(Graphics g) { x = 2.5; y = 3; g.drawString("metod1 in disi : x = "+x+" y = "+y,25,25); metod1(g); g.drawString("metod1 in disi : x = "+x+" y = "+y,25,55); }

Şekil 2.5.3 metodvesinifdeg1.java programında metod değişkenlerinin sınıfa aktarılması

va
49

public class metotvesinifdeg1 extends Applet { //buradaki değişkenler tüm sınıfa aittir double x ; int y ;

dil

i.c o

public void paint(Graphics g) { x = 2.5; y = 3; g.drawString("metod1 in disi : x = "+x+" y = "+y,25,25); metod1(g); g.drawString("metod1 in disi : x = "+x+" y = "+y,25,55); }

m

y=6; g.drawString("metod1 in ici : x = "+x+" y = "+y,25,40); }

50

Şekil 2.5.2 deki metodvesinifdeg1 sınıfındaki metod1 metodunun içinde ise yerel değişkenler x ve y tanımlanmıştır. Bu yüzden metod1 in içindeki x ve y değişkenlerinin değişmesi paint metodundaki drawString metodu tekrar çağırıldığında x ve y nin degerlerinin değişmediği görülür. Nesne tanımı yapıldığında Bilgisayar bu nesne için bir adres yaratır. Yeni adres yarat komutu new komutudur.
// java kutuphanelerinde tanimli bir sinifin cagirilip // nesne olarak tanimlanmasi ve adres paylasimi import java.io.*; //java girdi cikti sinifini cagir import java.awt.Point; //Point sinifini cagir class Point1 { public static void main(String args[]) { //Point sinifi x,y koordinatli bir nokta tanimlar Point nokta1,nokta2; nokta1=new Point(100,100); nokta2=nokta1; // nokta1 ve nokta2 bilgisayarda ayni // adres kutusunu paylasiyor System.out.println("nokta1 ve nokta2 ayni degerleri tasiyor"); System.out.println("ve ayn bilgisayar adresini paylasiyor"); System.out.println("nokta 1 : "+nokta1.x+" , "+nokta1.y); System.out.println("nokta 2 : "+nokta2.x+" , "+nokta2.y); nokta1.x=200; nokta1.y=200; System.out.println("nokta1 in degeri degistirildi"); System.out.println("nokta 1 : "+nokta1.x+" , "+nokta1.y); System.out.println("nokta 2 : "+nokta2.x+" , "+nokta2.y); // nokta1 ve nokta2 nin degerleri ayni fakat bilgisayarda // degisik adreslerde tanimlanmis nokta1=new Point(100,100); nokta2=new Point(100,100); System.out.println("nokta1 ve nokta2 ayni degerleri tasiyor"); System.out.println("fakat ayni bilgisayar adresini paylasmiyor"); System.out.println("nokta 1 : "+nokta1.x+" , "+nokta1.y); System.out.println("nokta 2 : "+nokta2.x+" , "+nokta2.y); nokta1.x=200; nokta1.y=200; System.out.println("nokta1 in degeri degistirildi"); System.out.println("nokta 1 : "+nokta1.x+" , "+nokta1.y); System.out.println("nokta 2 : "+nokta2.x+" , "+nokta2.y); } }

ww w. ja

va
50

dil

i.c o

Şekil 2.5.1 deki metodvesinifdeg sınıfındaki metot1 metodunun içinde değiştirilen x ve y değişkenleri tüm tüm sınıfa(class) aittir. Bu yüzden paint metodundaki drawString metodu tekrar çağırıldığında x ve y nin değerlerinin değiştiğini görürüz.

m

Metod1 in disi : x=2.5 y=3 Metod1 in ici : x=5.5 y=6 Metod1 in disi : x=2.5 y=3 Şekil 2.5.4 metodvesinifdeg1.java programının sonuçları

51

Point1.java da verilen
Point nokta1,nokta2; nokta1=new Point(100,100); nokta2=nokta1;

tanımında Point sınıfından(class) nokta1 ve nokta2 değişkenleri tanımlanmış, nokta1 değişkeni için yeni(new) adres tanımlanmış, nokta2 değişkenine de aynı adresi (nokta1 in adresini) kullanması soylenmiştir. Bu yüzden proğramda nokta1 e yeni deger verildiğinde nokta2 nin değeri de aynı değeri alır. daha sonra kullanılan
nokta1=new Point(100,100); nokta2=new Point(100,100);

JAVA PROGRAMLA DİLİ HAFTA 4

Bu haftaki incelenecek programlar : MATEMA~1 METOD1~1 METOD1~2 METOD2~1 METOD3~1 METOD3~2 METOD3~3 METOD4~1 METOD4~2 METOD4~3 POINT1~1 JAV JAV JAV JAV JAV JAV JAV JAV JAV JAV JAV 2.436 443 1.595 505 402 184 1.683 377 189 1.514 1.699

ww w. ja
Bu haftaki alistırmalar ALISTIRMA 1

10/05/98 09/05/98 10/05/98 10/05/98 10/05/98 10/05/98 10/05/98 10/05/98 10/05/98 10/05/98 10/05/98

a) Math kütüphanesindeki Math.random() metodunu kullanarak static zar metodunu yazınız. Bu metodu H4A1a sınıfında(class) tanımlayiniz. Not : 1-den 6 ya kadar tesadüfi (random) sayıları 1+(int)(Math.random()*6) formülü ile hesaplayabiliriz. public class H4A1a { public static int zar() { return 1+(int)(Math.random()*6); } } b) H4A1b sinifinda(class) java konsol ana metodu (public void main) yazarak zar degerini yazdiriniz. import java.io.*; // giris cikis import H4A1a;

va
51

dil
1:48 23:46 0:42 0:11 0:11 0:13 0:54 0:08 0:13 1:02 2:17

deyimi ile ise nokta1 ve nokta2 için iki ayrı adres yaratılmıştır. Bu yüzden nokta1 değiştiğinde nokta2 eski değerinde kalır.

i.c o
matematik1.java metod1.java metod1Applet.java metod2.java metod3.java metod3a.java metod3Applet.java metod4.java metod4a.java metod4Applet.java Point1.java

m

Şekil 2.5.5 Point1.java programda nokta1 ve nokta2 nesnelerinin yaratılması ve adres paylaşımı.

52

c) H4A1c sinifinda java konsol ana metodunda (public void main) metodunda yüz(100) kere zar attırarak ortalamasını hesaplayınız. Not : for veya while döngüsü kullanabilirsiniz. import java.io.*; // giris cikis import H4A1a;

} }

ww w. ja
import java.io.*; // giris cikis import H4A1a;

d) H4A1d sinifinda java konsol ana metodunda (public void main) bin(1000) kere zar attırarak her rakamın kac kere geldigini bulunuz ve yazdırınız. Not : switch – case deyimi bu tür programlar için idealdir

public class H4A1d { //bin zar atiminda her zar kac kere gelir public static void main (String args[]) throws IOException { int zardegeri; int zar1,zar2,zar3,zar4,zar5,zar6; int zaratimsayisi=0; zar1=0; zar2=0; zar3=0; zar4=0; zar5=0; zar6=0; while(zaratimsayisi<1000) { zardegeri=H4A1a.zar(); switch(zardegeri) {

va
52

{ toplam+=H4A1a.zar(); } ortalama=toplam/100.0; System.out.println("100 zarin ortalamasi = "+ortalama);

dil

class H4A1c { //yuz zarin ortalamasi public static void main (String args[]) throws IOException { double ortalama; double toplam=0; for(int sayi=0;sayi<100;sayi++)

i.c o

m

class H4A1b { public static void main (String args[]) throws IOException { System.out.println("zar degeri : "+H4A1a.zar()); } }

53

} }

ALIŞTIRMA 2

ww w. ja
import java.awt.*; import java.applet.Applet; import java.awt.event.*; public static int zar() { return 1+(int)(Math.random()*6); }

a) zarApplet.java programini incele ve calistir. b) ZarApplet.java programindaki zar metodunu H4A2b.java sınıfına yerlestir. ZarApplet.java programindaki zar metodunu sil ve import H4A2b; deyimini ekle. c) ZarApplet.java programını H4A2c olarak değiştir. sinifindan yeni nesne z yi H42c.java programına ekle ve Paint methodunda çağırılan zar metodunda gerekli değişiklikleri yap. Programi yeni sekliyle calıştır.

public class zarApplet extends Applet implements ActionListener { int toplamzaratisi=0; int toplam=0; TextField ilkzar,ikincizar; Button salla; //zar atma d gmesi int zar1,zar2;

public void init() { //programi baslat ilkzar=new TextField(10); // Textfield sinifi ilkzar nesnesini yarat

va
53

dil
zar zar zar zar zar zar 1 2 3 4 5 6 sayisi sayisi sayisi sayisi sayisi sayisi : : : : : : "+zar1); "+zar2); "+zar3); "+zar4); "+zar5); "+zar6);

case 1: zar1++; break; case 2: zar2++; break; case 3: zar3++; break; case 4: zar4++; break; case 5: zar5++; break; case 6: zar6++; break; } zaratimsayisi++; } System.out.println("toplam System.out.println("toplam System.out.println("toplam System.out.println("toplam System.out.println("toplam System.out.println("toplam

i.c o

m

54

ww w. ja
import import import import java.awt.*; java.applet.Applet; java.awt.event.*; H4A2b;

public class H4A2c extends Applet implements ActionListener { int toplamzaratisi=0; int toplam=0; TextField ilkzar,ikincizar; Button salla; //zar atma d gmesi int zar1,zar2; H4A2b z=new H4A2b(); public void init() { //programi baslat ilkzar=new TextField(10); // Textfield sinifi ilkzar nesnesini yarat add(ilkzar); // ilk zar nesnesini pencereye ekle ikincizar=new TextField(10);// Textfield sinifi ikincizar nesnesini yarat add(ikincizar); // ikinci zar nesnesini pencereye ekle salla=new Button("Zari salla ve at"); add(salla); salla.addActionListener(this);

va
54

public class H4A2b { public static int zar() { return 1+(int)(Math.random()*6); } }

dil
Atilan zar sayisi =

public void paint( Graphics g) { g.drawString("toplam = "+toplam+" "+toplamzaratisi,25,50); } }

i.c o

public void actionPerformed(ActionEvent e) { zar1=zar(); zar2=zar(); ilkzar.setText(Integer.toString(zar1)); ikincizar.setText(Integer.toString(zar2)); toplam+=(zar1+zar2); toplamzaratisi++; repaint(); }

m

add(ilkzar); // ilk zar nesnesini pencereye ekle ikincizar=new TextField(10);// Textfield sinifi ikincizar nesnesini yarat add(ikincizar); // ikinci zar nesnesini pencereye ekle salla=new Button("Zari salla ve at"); add(salla); salla.addActionListener(this); }

55

} public void actionPerformed(ActionEvent e) { zar1=z.zar(); zar2=z.zar(); ilkzar.setText(Integer.toString(zar1)); ikincizar.setText(Integer.toString(zar2)); toplam+=(zar1+zar2); toplamzaratisi++; repaint(); } public void paint( Graphics g) { g.drawString("toplam = "+toplam+" "+toplamzaratisi,25,50); } }

Atilan zar sayisi =

JAVA PROGRAMLAMA DİLİ HAFTA 5

Geçen Haftanın Alıştırmaları : H4A2B~1 H4A2C~1 H4A1B~1 H4A1A~1 H4A1C~1 H4A1D~1 JAV JAV JAV JAV JAV JAV 99 1.117 212 99 424 1.255

ww w. ja
Bu haftaki incelenecek problemler : FAKTOR~1 JAV 448 02/05/98

import java.io.*; import Text; class faktoriyel { public static void main(String args[]) throws IOException { int faktoriyel=1; DataInputStream cin=new DataInputStream(System.in); int faktoriyelsayi; System.out.println("Bir tamsayi giriniz:"); faktoriyelsayi=Text.readInt(cin); for(int sayi=1;sayi<=faktoriyelsayi;sayi++) { faktoriyel*=sayi;} System.out.println(faktoriyelsayi+" faktoriyel: "+faktoriyel); } }

va
19/05/98 19/05/98 19/05/98 19/05/98 19/05/98 19/05/98 22:18 22:04 23:43 22:18 22:35 22:53 55

dil
H4A2b.java H4A2c.java H4A1b.java H4A1a.java H4A1c.java H4A1d.java 22:32 faktoriyel.java

i.c o

m

56 FAKTOR~2 JAV 404 20/05/98 0:17 faktoriyeltesti.java

import java.awt.Graphics; import java.applet.Applet; public class faktoriyeltesti extends Applet { public void paint(Graphics g) { int y=25; for(long i=0;i<=10;i++) { g.drawString(i+"! = "+faktoriyel(i),25,y); y+=15; } } public long faktoriyel(long sayi) { if(sayi <=1) return 1; else return sayi*faktoriyel(sayi - 1); } }

ww w. ja
}

public class fibonachitesti1 extends Applet { public void paint(Graphics g) { int y=25; for(long i=0;i<=15;i++) { g.drawString("Fibonachi("+i+") = "+fibonachi(i),25,y); y+=15; } } public long fibonachi(long sayi) { if(sayi <=0) return 0; else if(sayi ==1) return 1; else return fibonachi(sayi - 1)+fibonachi(sayi - 2); }

va
56

FIBONA~1 JAV 463 import java.awt.Graphics; import java.applet.Applet;

20/05/98

dil

i.c o
0:26 fibonachitesti1.java

m

57

FIBONA~2 JAV

1.063

20/05/98

import java.awt.*; import java.applet.Applet; import java.awt.event.*;

ww w. ja
public long fibonachi(long sayi) { if(sayi <=0) return 0;

public void init() { rakametiketi=new Label("Bir tamsayi giriniz : "); rakam=new TextField(10); rakam.addActionListener(this); sonucetiketi=new Label("Fibonachi degeri : "); sonuc=new TextField(10); sonuc.setEditable(false); add(rakametiketi); add(rakam); add(sonucetiketi); add(sonuc); } public void actionPerformed( ActionEvent e) { long sayi; long fibonachisayisi; sayi=Long.parseLong(rakam.getText()); showStatus("Fibonachi hesaplan yor...."); fibonachisayisi=fibonachi(sayi); showStatus("Fibonachi hesaplandi...."); sonuc.setText(Long.toString(fibonachisayisi)); }

va
57

public class fibonachitesti2 extends Applet implements ActionListener { Label rakametiketi,sonucetiketi; TextField rakam,sonuc;

dil

i.c o
0:47 fibonachitesti2.java

m

58

} }

FAKTOR~3 JAV import java.io.*; import Text;

522

20/05/98

ww w. ja
Bu haftaki alıştırmalar : ALIŞTIRMA 1 import import import public { // bu sinif kupun hacmini hesaplar

public static void main(String args[]) throws IOException { DataInputStream cin=new DataInputStream(System.in); int faktoriyelsayi; System.out.println("Bir tamsayi giriniz:"); faktoriyelsayi=Text.readInt(cin); System.out.println(faktoriyelsayi+" faktoriyel:" + faktoriyel(faktoriyelsayi)); } }

Bir kürenin hacmini hesaplayacak bir applet programı yazınız. Kürenin hacmi küreHacmi isimli metod tarafından hesaplansın. Applet bir girdi alanına kürenin yariçapını sorsun ve yarıçap girildiğinde yeni küre hacmi ekranda gösterilsin. Not : Kürenin hacmi : (4.0/3.0)*Math.PI*Math.pow(r,3); java.applet.Applet; // java applet sinifini cagir java.awt.*; // java pencere kullanma sinifini cagir java.awt.event.*; // java pencereyi dinleme sinifini cagir class H5A1 extends Applet implements ActionListener

va
58

class faktoriyel2 { public static long faktoriyel(int x) { if( x <= 1 ) return 1; else return x * faktoriyel( x - 1); }

dil

i.c o
1:12 faktoriyel2.java

m

else if(sayi ==1) return 1; else return fibonachi(sayi - 1)+fibonachi(sayi - 2);

59

ww w. ja

//===================================================== // sinif degiskenleri // bu degiskenler tum s n fa aittir Label kutubasligi; //Label sinifi degiskeni (nesnesi) kutubasligi TextField kutugirdisi;// Textfield sinifi degiskeni (nesnesi) kutugirdisi double yaricap; // Gercek degisken yar cap double hacim; // Gercek degisken hacim //===================================================== // pencereyi baslatma metodu // pencere ilk basladiginda // degiskenler buradaki degerleri alirlar public void init() { kutubasligi=new Label("Kubun yaricapini (m)giriniz : "); add(kutubasligi); kutugirdisi=new TextField(10); add(kutugirdisi); yaricap=0; hacim=0; kutugirdisi.addActionListener(this); } //===================================================== // girdi alanindaki olan olaylari dinleme metodu // Her yeni rakam girildiginde bu metod cagirilir public void actionPerformed(ActionEvent e) { Double sayi1=new Double(e.getActionCommand() ); yaricap=sayi1.doubleValue(); hacim=kubunhacmi(yaricap); kutugirdisi.setText(" ");//kutudaki rakami sil repaint();//pencereyi yeniden paint metoduna gore ciz } //===================================================== // paint (boya=pencereye ciz metodu) public void paint(Graphics g) { g.drawString(yaricap+" m capindaki kubun hacmi : "+hacim+" m^3",25,50); } //===================================================== //kubun hacmini hesaplama metodu public double kubunhacmi(double r) { return (4.0/3.0)*Math.PI*r*r*r; } }

va
59

dil

i.c o

m

60 ALIŞTIRMA 2 Bir dik üçgenin hipotenüsünü hesaplayan bir applet programı yazınız. Program dik üçgenin iki dik kenarını applet de girsin ve hipotenus metoduyla hesaplasın ve sonucu applete yazdırsın. Not : Dik üçgenin hipotenüsü : Hipotenüs = Math.sqrt(dikkkenar1*dikkenar1+dikkenar2*dikkenar2);

ww w. ja

import java.applet.Applet; // java applet sinifini cagir import java.awt.*; // java pencere kullanma sinifini cagir import java.awt.event.*; // java pencereyi dinleme sinifini cagir public class H5A2 extends Applet implements ActionListener { // bu s n f dik ucgenin hipotenusunu hesaplar //===================================================== // sinif degiskenleri // bu degiskenler tum s n fa aittir Label kutubasligi1; //Label sinifi degiskeni (nesnesi) kutubasligi1 TextField kutugirdisi1; // Textfield sinifi degiskeni (nesnesi) kutugirdisi1 Label kutubasligi2; //Label sinifi degiskeni (nesnesi) kutubasligi2 TextField kutugirdisi2; // Textfield sinifi degiskeni (nesnesi) kutugirdisi2 double dikkenar1; // Gercek degisken dikkenar1 double dikkenar2; // Gercek degisken dikkenar1 //===================================================== // pencereyi baslatma metodu // pencere ilk basladiginda // degiskenler buradaki degerleri alirlar public void init() { kutubasligi1=new Label("Birinci dik kenari giriniz : "); add(kutubasligi1); kutugirdisi1=new TextField(10); add(kutugirdisi1); kutubasligi2=new Label("Ikinci dik kenari giriniz : "); add(kutubasligi2); kutugirdisi2=new TextField(10); add(kutugirdisi2); dikkenar1=0; dikkenar2=0; kutugirdisi2.addActionListener(this); } //===================================================== // girdi alanindaki olan olaylari dinleme metodu // Her yeni rakam girildiginde bu metod cagirilir public void actionPerformed(ActionEvent e) { Double sayi1=new Double(kutugirdisi1.getText() ); dikkenar1=sayi1.doubleValue(); Double sayi2=new Double(kutugirdisi2.getText() ); dikkenar2=sayi2.doubleValue(); //kutugirdisi.setText(" ");//kutudaki rakami sil repaint();//pencereyi yeniden paint metoduna gore ciz } //===================================================== // paint (boya=pencereye ciz metodu) public void paint(Graphics g) {

va
60

dil

i.c o

m

61

ww w. ja
61

va

dil

i.c o

}

m

g.drawString(" hipotenus = "+hipotenus(dikkenar1,dikkenar2),25,80); } //===================================================== //ucgenin hipotenusunu hesaplama metodu public double hipotenus(double dk1,double dk2) { return Math.sqrt(dk1*dk1+dk2*dk2); }

62

3.1 Sınıf yapısının genel tanımı

Sınıf (Class) deyince herhangi bir nesnenin genel tanımlanmasını anlıyoruz. Bu sınıflardan değişkenler tanımandıklarında nesneleri oluştururlar. Örneğin kalem dediğimizde genel bir sınıfı anlatıyoruz. Alinin cebindeki kırmızı kalem ise belirli bir nesnedir. Sınıfın genel tanımı şu şekilde yapılabilir : Class sınıfın_ismi { //sınıfa ait değişken listesi değişken_türü değişken_ismi; değişken_türü değişken_ismi; ......... //sınıfa ait metot listesi degişken türü metotadı(metod girdi değişken listesi) { //metodun içindeki hesaplanan işlemler return çıktı_değişkeni; } ..............

ww w. ja
Class Kutu { double en; double boy; double yukseklik; } Kutu benimkutum= new Kutu();

}

Sınıf (class) tanımında metodların bulunması şart değildir. Bulundukları takdirde bunlar o sınıfa ait veya sinifin üyesi metodlar olarak düşünülür. İlk sınıf örneği olarak içinde hiçbir metodun yer almadığı bir kutu sınıfı tanımlıyalım. Bir kutuyu üç geometrik boyutu (eni,boyu,yüksekliği) cinsinden tanımlayabiliriz.

Üstte bahsettiğimiz gibi sınıf yeni bir değişken türü yaratır. Yukardaki sınıfın yarattığı değişken türünün adı Kutu’dur. Kutu değişkenini başka bir proğramda tanımlarken budeğişken türünden bir nesne yaratılır. Örneğin

va
62

dil

i.c o

Şu na kadarki bütün programlarımızda sınıf(class) yapısını kullandık. Fakat tam olarak sınıfların ne olduğunu ve neler yapabileceklerini anlatmadık. Sınıf yapısının en onemli ozelliği yeni bir değişken türü tanımlıyor olmasıdır. Şu ana kadar programlarımızı tanımlamak amacıyla çeşitli sınıflar tanımladık. Bu bölümde sınıfları değişken türü olarak tanımlamasını ve kullanmasını göreceğiz.

m

BÖLÜM 3 : Sınıf (Class) Yapılarına Giriş

63

Benimkutum.en=1.0;

Şimdi Kutu değişkenini kullanacak ufak bir kututestı sınıfı oluşturalım ve Kutu sınıfını bu sınıfta kullanalım.
import java.io.*; class Kutu { double en; double boy; double yukseklik; }

ww w. ja
Benim kutumun hacmi : 6000.0

Bu programın adının kututesti.java olması zorunludur. Çünki ana metod(main) kututesti sınıfında tanımlanmıştır. Fakat programı javac terimiyle bilgisayar diline çevirdiğimizde iki tane sınıf(class) dosyasının oluştuğunu görürüz. Birisi Kutu.class diğeride kututesti.class. Ana program kututesti olduğu için bu programın işletimi java kututesti deyimini kullanarak yapılır. Program işletildiğinde

Sonucunu verir. Benim kutum nesnesi yaratıldığında bilgisayar belleğinde benimkutum için nir adres tanımlanır. New Kutu() deyimi verildiğinde ise bilgisayrın belleginde en,boy ve yükseklik değişkenleri için yer ayrılır ve bu yerlerin adresleriyle benim kutum nesnesinin adresi arasında bağlantı sağlanır. Bunu grafik olarak anlatalım : Bilgisayar belleği
Null

Deyim Kutu benimkutum;

Benimkutum=new Kutu();

va
Benimkutum
63

class kututesti { public static void main(String args[]) { Kutu benimkutum=new Kutu(); double hacim; benimkutum.en=10.0; benimkutum.boy=20.0; benimkutum.yukseklik=30.0; hacim=benimkutum.en*benimkutum.boy*benimkutum.yukseklik; System.out.println("Benim kutumun hacmi : "+hacim); } }

dil
En Boy

i.c o
Yukseklik

m

Benimkutum kutu türünde tanılanmış bir nesnedir. Bu nesnenin kendisinin de en boy ve yükseklik olmak üzere üç alt değişkeni mevcuttur. Eğer bir programda benimkutum değişkeni tanımlanmışsa, bu değişkenin alt degişkenlerine şu şekilde ulaşılabilir :

64

Benimkutum Not null terimi bilgisayar beleğinin boş olduğunu gösterir. Yukardaki grafikte ilk olarak Kutu benimkutum; tanımı yapıldığında bilgisayar belleğinde 1 byte boyutunda bir yer tanımlar. Ve bu yere bos anlamına gelen null degerini yükler. İkinci durumda ise (benimkutum=new Kutu() tanımında) benimkutum nesne adresindeki kutuda en,boy,yükseklik değişkenlerinin adresleri kaydedilmiştir. Bu adres aracılığıyla en boy ve yükseklik değişkenlerine benimkutum degişkeni üzerinden ulaşılabilir. Diğer deyimle en,boy,yükseklik benim kutum nesnesinin alt değişkenleridir.

3.2 Kurucu ( constructor ) metot

İkinci bir programda Kutu sınıfı iki nesne tanımlama gereği duyduğumuzu varsayalım. Buna ornek olarak Şekil 3.2.1 de kututesti1.java programı tanımlanmıştır.
import java.io.*; class Kutu { double en; double boy; double yukseklik; }

ww w. ja
Bu programın çıktısı : Benim kutumun hacmi : 6000.0 Benim kutumun hacmi : 750.0

class kututesti1 { public static void main(String args[]) { double hacim; Kutu benimkutum1=new Kutu(); benimkutum1.en=10.0; benimkutum1.boy=20.0; benimkutum1.yukseklik=30.0; hacim=benimkutum1.en*benimkutum1.boy*benimkutum1.yukseklik; System.out.println("Benim kutumun hacmi : "+hacim); Kutu benimkutum2=new Kutu(); benimkutum2.en=5.0; benimkutum2.boy=10.0; benimkutum2.yukseklik=15.0; hacim=benimkutum2.en*benimkutum2.boy*benimkutum2.yukseklik; System.out.println("Benim kutumun hacmi : "+hacim); } } Şekil 3.2.1 Kutu sınıfı iki nesne tanımlayan kututesti1.java programı

Bu programda Kutu sınıfından benimkutum1 ve benimkutum2 değişkenler tanımlanmıştır. Bu basit programda bile en,boy ve yükseklik değikenlerini iki defa çağırmak listenin uzamasına sebep olmuştur. Gerçek uygulamalarda ise çok daha yüksek sayıda değişken içeren sınıflar oluşturulabilir ve bu sınıflarda oluşturulan toplam nesne sayısı da çok fazla olabilir. Bu yüzden nesneyi ilk tanımlarken aynı zamanda değişkenlerinin değerlerini de tanılayabilirsek, çok daha okunaklı ve kısa bir bilgisayar listesiyle aynı

va
64

dil

i.c o

m

65 işi yapabiliriz. Bu iş için kurucu (constructor) adı verilen metodlar kullanılır. Kurucu metodları diğer metodlardan biraz farklıdır. Once metod önüne metod değişken türü gelmez ve metod dışına hiçbir değişken göndermezler. İsimleri de herzaman sınıf(class) ismiyle aynı olur. Şekil 3.2.1 deki programı kurucu (constructor) metodu kullanarak tekrar yazalım. import java.io.*; class Kutu { double en; double boy; double yukseklik; //kurucu metod kutu Kutu(double e,double b,double y) { en=e; boy=b; yukseklik=y; } }

ww w. ja
Bu programın çıktısı : Benim kutumun hacmi : 6000.0 Benim kutumun hacmi : 750.0 Kutu benimkutum1=new Kutu(); Tanımı yerini

Şekil 3.2.2 Kutu sınıfı iki nesneyi kurucu(constructor) metodu yardımıyla tanımlayan kututesti2.java programı

Görüldüğü gibi bu program bir öncekinin aynı sonucu vermiştir. Faket burada bir önceki programda yapılan

Kutu benimkutum1=new Kutu(10.0,20.0,30.0);

Tanımına bırakmış ve kututesti2 sınıfı yazılırken en ,boy yükseklik değişkenlerinin yeniden tanımlanması ihtiyacını ortadan kaldırmıştır.

va
65

class kututesti2 { public static void main(String args[]) { double hacim; Kutu benimkutum1=new Kutu(10.0,20.0,30.0); hacim=benimkutum1.en*benimkutum1.boy*benimkutum1.yukseklik; System.out.println("Benim kutumun hacmi : "+hacim); Kutu benimkutum2=new Kutu(5.0,10.0,15.0); hacim=benimkutum2.en*benimkutum2.boy*benimkutum2.yukseklik; System.out.println("Benim kutumun hacmi : "+hacim); } }

dil

i.c o

m

66

3.3 Diğer metotlar
Tekrar yukarıda incelediğimiz kutu sınıfını göz önüne alalım. Hacim bir kutunun özellikleri arasında yer alır, ve her zaman kutunun hacminin hesaplanması gerekebilir. Bu yüzden hacim işlemini Kutu sınıfının içinde tanımlamak daha ideal olacaktır. Şekil 3.3.1 deki kutuornegi3.java programında hacim hesaplarını yapan hacim metodu Kutu sınıfının içinde tanımlanmıştır.
import java.io.*; class Kutu { double en; double boy; double yukseklik; //kurucu metod kutu Kutu(double e,double b,double y) { en=e; boy=b; yukseklik=y; }

}

ww w. ja

class kututesti3 { public static void main(String args[]) { Kutu benimkutum1=new Kutu(10.0,20.0,30.0); System.out.println("Benim kutumun hacmi : "+benimkutum1.hacim() ); Kutu benimkutum2=new Kutu(5.0,10.0,15.0); System.out.println("Benim kutumun hacmi : "+benimkutum2.hacim() ); } }

Şekil 3.3.1 Kutu sınıfı iki nesneyi kurucu(constructor) metodu yardımıyla tanımlayan ve hacmi hacim() metoduyla hesaplayan kututesti3.java programı

Bir önceki bölümde metod yazımı konusunda anlattıklarımızın hepsini buraya ilave edebiliriz.

3.3 Diğer metotlar 3.4 this deyiminin kullanımı

bazen bir metodun içinde o metodun ait olduğu sınıftan yaratılacak nesneyi veya o nesnenin bir alt değişkenini tanımlamak gerekir. Nesne daha tanımlanmadığindan direk olarak nesne ismini kullanamayız. Bunun yerina java this deyimini kullanır. This deyimi bilhassa sınıfa ait değişken silerinin aynısı metodda kullanılmışsa işe yarar. Bu durumda tüm sınıfa ait değişkenler this.değişken_ismi komutuyla çağırılabilir. Eçen bölümde sınıf ve metota ait değişkenleri izlerken metotvesinifdeg.java ve metotvesinifdeg1.java isimlerinde iki örnek
66

va

//bu metot kutunun hacmini hesaplar double hacim() { return en*boy*yukseklik; }

dil

i.c o

m

67

problemi incelemiştik. Şimdi de aynıgruptan metotvesınıfdeg3.java programını inceleyelim.
import java.awt.Graphics; import java.applet.Applet; public class metotvesinifdeg3 extends Applet { //buradaki degiskenler tum sinifa aittir double x ; int y ;

}

Şekil 3.4.1 metodvesinifdeg3.java programıyla ve this deyimi yardımıyla metotun içinde yerel ve sınıfa ait değişkenlere ulaşım. Sınıfa ait her değişkeni başına this. Getirerek kullanabiliriz. Fakat this kullanımı mutlaka gerekli değilse kullanılmaması tavsiye edilir. Örneğin yukarıdaki kurucu metot kutu //kurucu metod kutu Kutu(double e,double b,double y) { this.en=e; this.boy=b; this.yukseklik=y; }

ww w. ja
public class dortislemhesapmakinasi { //sınıf değişkenleri x1 ve x2

şeklinde yazılabilirdi. Fakat sınıfta aynı isimde başka değişken olmadığından bilgisayar zaten bu değişkenlerin sınıfa ait olduklarını bilmektedir ve ayrıca tekrarlamaya gerek yoktur.

3.5 sınıf değişkenlerinin dış dünyadan gizlenmesi

Aşağıda dort işlem (toplama cıkarma carpma bolme yapan dortislemhesapmakinasi sınıfını görüyorsunuz.

va
67

public void paint(Graphics g) { x = 2.5; y = 3; metod1(g); }

dil

void metod1( Graphics g) //metoda hi‡ bir de§iŸken girmiyor { double x; int y; x=5.5; y=6; //tum sinifa at degiskenler this kelimesi ile birlikte kullanilabilirler g.drawString("metod1 in dis degiskenleri this ile ulasim : x = "+this.x+" y = "+this.y,25,25); g.drawString("metod1 in ic degiskenleri : x = "+x+" y = "+y,25,40); }

i.c o

m

68 private double x1,x2; // kurucu metot dortislemhesapmakinesi public dortislemhesapmakinasi(double y1,double y2) { //constructor x1=y1; x2=y2; } // ikinci bir kurucu metot dortislemhesapmakinesi public dortislemhesapmakinasi() { x1=1; x2=1; } public double topla() { return x1+x2; } public double cikar() { return x1-x2; } public double carp() { return x1*x2; } public double bol() { return x1/x2; }

ww w. ja
}

//bu metodla x1 in değeri değiştirilir public void ilksayigir(double y1) { x1=y1; }

//bu metodla x2 nin değeri değiştirilir public void ikincisayigir(double y2) { x2=y2; } //bu metodla x1 ve x2 nin değerleri değiştirlir public void ikisayigir(double y1,double y2) { x1=y1; x2=y2; }

Şekil 3.5.1 dörtislemhesapmakinasi.java programı ve sınıf değişkenlerinin değerlerinin metod kullanılarak değiştirilmesi

va
68

dil

i.c o

m

69

dortislemhesapmakinasi.java programının x1 ve x2 değişkenlerine private sözcüğü kullandığımız için dortislemhesapmakinasi h = new dortislemhesapmakinasi(); h.x1 = 2.0; h.x2 = 3.5;

şeklinde ulaşılamaz. Aynı işlemi yapmak için aşağıdaki üç yoldan birini kullanabiliriz.

veya

veya

dortislemhesapmakinasi h = new dortislemhesapmakinasi(2.0,3.5);

3.6 Sınıflarda Kalıtım (inheritance)

ww w. ja
public class daire extends nokta

Bir sınıfın kurulmasında o sınıfla direk olarak ilişkisi olan bir sınıftan onun tüm metodları ve değişkenleri kalıtım (inheritance) yoluyla yeni kurulan bir sınıfa aktarılabilir. Kalıtım için sınıf(class) tanımında extends kelimesi kullanılır. Eğer bir sınıftan daha alt sınıflara kalıtım yoluyla aktarma yapılacaksa privatedeğişken türü yerini protected değişken türüne bırakır. Protected private deyiminin aynıdır. Fakat kalıtımla değişkenlerin aktarıldığı alt sınıflara değişkenleri görme izni verir. Private terimi ise kalıtımla aktarılan alt sınıflardan bile o değişkenleri saklar.

Şekil 3.6.1 de nokta sınıfı tanımlanmıştır. Şekil 3.6.2 de ise nokta sınıfından kalıtım yoluyla yaratılan daire sınıfını görüyoruz. Programda da görüleceği gibi daire sınıfının tanımı

terimiyle yapılmıştır. Ayrıca daire sınıfının kurucusu yazılırken nokta sınıfının kurucusu direk olarak super(a,b); terimiyle çağırılmıştır.

Burada önemli bir noktayı hatırlatalım : bir sınıf sadece bir tane başka sınıfın netod ve değişkenlerini kalıtım yoluyla aktarabilir.

va
69

dortislemhesapmakinasi h = new dortislemhesapmakinasi(); h.ikisayigir(2.0,3.5);

dil

dortislemhesapmakinasi h = new dortislemhesapmakinasi(); h.ilksayigir(2.0); h.ikincisayigir(3.5);

i.c o

m

Bu sınıfta (class) sınıf değişkenleri x1 ve y1 in değerlerinin değiştirilmesi için üç metot yazılmıştır.. Bunun sebebi programlarda sınıfa ait değişkenlere dışarıdan direk ulaşımın önlenmesini sağlamaktır. İyi programlama şartlarından birisi sınıfın değişkenlerine sadece o sınıfın metotları üzerinden ulaşmaktır. Herkese serbest ulaşım verilmez. Hatta bunu saglamak için değişkenlerin başına sadece bu sınıfa aittir dışarıdan kullanılamaz anlamındaki private sözcügü getirilebilir.

70

public class nokta { protected double x, y; public nokta(double a, double b) { noktagir(a,b); } }

public void noktagir(double a, double b) public double Xoku() return x; } public double Yoku() { return y; } {

public String toString() { return "["+x+","+y+"]"; } }

Şekil 3.6.1 nokta.java programı ve nokta sınıfının tanımı.

import nokta; public class daire extends nokta { protected double yaricap;

ww w. ja
} public void yaricapgir(double r) { if(r >= 0.0) yaricap=r; else yaricap=0.0; } public double yaricapoku()

public daire() { //daire kalitim yaptigi nokta sinifinin kurucu metodunu // super deyimi ile cagirabilir. super(0,0); yaricapgir(0); } public daire(double r, double a, double b) { super(a,b); yaricapgir(r);

va
70

dil

i.c o
{ x=a;

m
y=b;

71

{ }

public double alan() { return 3.14159*yaricap*yaricap; } public String toString() { return "Merkez = "+"["+x+","+y+"]"+ "; Yaricap="+yaricap; } }

Şekil 3.6.2 daire.java programı ve daire sınıfının tanımı. Daire sınıfı nokta sınıfından Kalıtım (inheritance) yoluyla türetilmiştir.

3.7 Sınıfları başka bir sınıfta nesne olarak çağırarak bir araya getirme (composition)
Sınıftaki değişken ve metodları kalıtım yoluyla aktarabildiğimiz gibi, sadece üst sınıfa ait bir nesne (object) tanımını alt sınıfta tanımlıyarak ta yapabiliriz.
import nokta; public class daire1 { protected double yaricap; protected nokta merkez; public daire1() {

ww w. ja
merkez=new nokta(0,0); yaricapgir(0); } } public void yaricapgir(double r) { if(r >= 0.0) yaricap=r; else yaricap=0.0; } public double yaricapoku() { return yaricap;

public daire1(double r, double a, double b) { merkez=new nokta(a,b); yaricapgir(r);

va
71

dil

Kalıtım yoluyla aktarılan bir metod yeni programda o programın içinde yazılmış gibi aynen kullanılabilir.

i.c o

m

return yaricap;

72

} public double alan() { return Math.PI*yaricap*yaricap; }

}

Şekil 3.7.1 daire1.java programı ve daire sınıfının tanımı. Nokta sınıfı daire1 sınıfında merkez adlı nesne olarak tanımlanmıstır.

3.8 Kalıtım yoluyla alt sınıfa bağlanmış üst sınıf referansı üzerinden alt sınıfı çağırma
Yukarıda nokta ve daire sınıflarını tanımlamıştık. Baska bir sınıftan kalıtım yoluyla türeyen sınıfın(dairenin noktadan kalıtım yoluyla türemesi gibi), üst sınıfın adresi(tanımı) üzerinden programın içinde aktarımı mümkündür.
import java.awt.Graphics; import java.applet.Applet;

ww w. ja

public class noktatesti extends Applet { private nokta noktaref,n; private daire daireref,d; public void init() { n=new nokta(30,50); d=new daire(2.7,120,89); } public void paint(Graphics g) { //once noktamızı ve dairemizi yazdıralım g.drawString("Nokta n : "+n.toString(),25,25); g.drawString("Daire d : "+d.toString(),25,40); //c dairesinin adresini nokta olarak tan mlanan noktaref e aktaral m noktaref=d; g.drawString("Daire(noktaref uzerinden) :"+noktaref.toString(),25,70); //noktaref nesnesini daireref degiskenine aktaral m daireref=(daire)noktaref; g.drawString("Daire(daireref uzerinden) :"+daireref.toString(),25,85); g.drawString("Dairenin alani(daireref uzerinden) :"+daireref.alan(),25,100); } } Şekil 3.8.1 noktatesti.java sınıfında üst sınıf üzerinden adres referansı kullanımı

Şekil 3.8.1 de görülen noktatesti.java sınıfında n nokta sınıfı nesnesi ve noktaref noktasinifi nesnesi ve d ve daireref daire sinifi nesneleri tanımlanmiştır. İnit metodunda p ve c nesnelerinin adresleri kurucu metodu new deyimiyle taşıyarak tanımlanmiştir. Dahasonra noktaref=d; deimiyle aslında daire sınıfından olan d nesnesi nokta sınıfından tanımlanan

va
72

dil

i.c o

public String toString() { return "Merkez = "+"["+merkez.x+","+merkez.y+"]"+ "; Yaricap="+yaricap; }

m

73 noktaref nesnesinin adresine yüklenmiştir. Programda da görüldüğü gibi noktaref üzerinden daireyi kullanmak mümkündür çünki nokta dairenin kalıtın yoluyla üst sınıfıdır. Aynı zamanda cast işlemcisi (daire) terimini kullanarak noktaref’i daireref’e aktarmak da mümkün olmuştur. Bu aktarma nokta dairenin super sınıfı olmasa başarılamazdı. Bazen sadece bu süper sınıf aktarımını saglamak amacıyla sınıf hiyerarşisinin en tepesine aslında belli bir görevi olmıyan abstract sınıflar yerleştirilir. Bu sınıfın alt sınıfları olarak tanımlanan tüm sınıflar bu sınıf adresinden yararlanılarak aktarılabilir. Abstract sınıfların tanımında abstract sözcüğü kullanılır. Abstract tür metodların içinde metodların sadece başlıkları verilip tanımları yapılmıyabilir. (metodun ana gövdesi tanımlanmıyabilir). Abstract super sınıfının kullanılmasına şöyle bir örnek verebiliriz : sekil isimli bir abstract sınıfın alt sınıfları olarak daire,üçgen,dikdörtgen ve kare sınıflarını olusturduğumuzu ve bu sınıfların herbirinin kendi şeklini çizecek ciz metodunu içerdiğini düşünelim. Programı yazarken abstract sınıf sekilde de alan metodu tanımı yaparız. Ve sekil sınıfından bir nesne tanımlarız. Program calışırken sekil üzerinden istediğimiz alt şeklin çizimi dinamik olarak her biri için atrı adres tanımlamadan mümkün olur. Aynı şekilde bir nümerik analiz programı yazarken, örneğin her değişik fonksiyon için ayrı ayrı integral metodu yazma yerine abstract tür bir fonksiyon için integral programını yazar ve gerçek foksiyonumuzu tanımladığımız sınıfı bu abstract sınıfın alt sınıfı olarak tanımlarız. Bu kavramı daha sonraki bölümlerimizde daha geniş örneklerle açıklamaya çalışacağız.

3.9 nesneyi dinamik olarak silmek finalize() metodu

ww w. ja
JAVA PROGRAMLAMA DİLİ HAFTA 6 Bu hafta KUTUTE~1 KUTUTE~2 KUTUTE~3 KUTUTE~4 DAIRE~1 DAIRE1~2 DAIRET~2 DAIRET~3 NOKTA~1 H5A1~1 incelenecek dosyalar : JAV 655 24/05/98 JAV 655 24/05/98 JAV 582 24/05/98 JAV 611 24/05/98 JAV 809 24/05/98 JAV 766 24/05/98 JAV 665 24/05/98 JAV 682 24/05/98 JAV 423 24/05/98 JAV 2.021 24/05/98

protected void finalize() throws Throwable { super.finalize(); }

Geçen haftaki alıştırmaların çözümleri H5A1~1 JAV 2.021 24/05/98 12:32 H5A1.java H5A2~1 JAV 2.456 24/05/98 12:48 H5A2.java 14:58 14:58 16:00 15:16 20:44 22:07 22:03 22:08 20:42 12:32 kututesti.java kututesti1.java kututesti3.java kututesti2.java daire.java daire1.java dairetest.java dairetest1.java nokta.java H5A1.java

va
73

Java dili kullanılmayan nesneleri silmek için arka planda çalışan bir sisteme sahiptir. Bu yüzden C++ gibi dillerde dinamik nesne tanımlarında mutlaka yer alması gereken nesneyi silme metodları javada o kadar gerekli değildir. Fakat eğer kendiniz metlaka bir nesneyi acil olarak silmek isteseniz finalize() isimli bir metodu sınıfınızda tanımlayıp kullanabilirsiniz. Örnek olarak aşağıdaki metodu verebiliriz.

dil

i.c o

m

74 H5A2~1 JAV 2.456 24/05/98 12:48 H5A2.java

Bu haftaki alıştırmalar : ALIŞTIRMA 1

ALIŞTIRMA 2

ALIŞTIRMA 3

ALIŞTIRMA 4

Dikdortgentesti1 sınıfını yaz. Bu sınıfta dogruyu tanımlıyan uç noktaları applet programına dışardan değişken olarak gir

ww w. ja
JAVA PROGRAMLAMA DİLİ HAFTA 7 Gecen haftaki alıştırmaların çözümleri : JAV 867 DOGRU~1 01/06/98

import nokta;

public class dogru { protected nokta n1,n2;

//kurucu metod metot girdisi x1,y1,x2,y2 public dogru(double x1, double y1,double x2,double y2) { n1=new nokta(x1,y1); n2=new nokta(x2,y2); } //kurucu metod, method girdisi iki nokta public dogru(nokta nokta1,nokta nokta2) { n1=new nokta(nokta1.x,nokta1.y);

va
74

Dogrutesti1 sınıfını yaz. Bu sınıfta dogruyu tanımlıyan uç noktaları konsol programına dışardan değişken olarak gir.

dil
22:59 dogru.java

Nokta sınıfını kullanarak dikdortgen sınıfını yarat. Dikdörtgen iki noktayla tanımlanır. Dikdortgen sınıfının kurucu metodunu, çevresini hesaplayan çevre metodunu, Alanını hesaplayan alan metodonu, dikdortgeni tanımlayan iki noktayı String değişkeni olarak tanımlayan toString metodunu ve gerekli olan diğer metodları tanımla. Applet programı olarak dikdortgentesti sınıfı oluşturarak bu sınıfın içinde cokguzelbirdikdortgen isimli bir nesne oluştur be bu nesnenin baslangıç ve bitiş noktalarıyla boyunu yazdır. Girdi değerlerini program içinde sabit olarak tanımla.

i.c o

Nokta sınıfını kullanarak dogru sınıfını yarat. Doğru iki noktayla tanımlanır. Dogru sınıfının kurucu metodunu, boyunu hesaplayan boy metodunu, uç noktalarını String değişkeni olarak tanımlayan toString metodunu ve gerekli olan diğer metodları tanımla. Konsol programı olarak dogrutesti sınıfı oluşturarak bu sınıfın içinde cokdogrubirdogru isimli bir nesne oluştur be bu nesnenin baslangıç ve bitiş noktalarıyla boyunu yazdır. Girdi değerlerini program içinde sabit olarak tanımla.

m

75

public void dogrugir(double x1, double y1,double x2,double y2) { n1.noktagir(x1,y1); n2.noktagir(x2,y2); } public String toString() { return "("+n1.toString()+","+n2.toString()+")"; }

public double boy() { return Math.sqrt((n1.Xoku()-n2.Xoku())*(n1.Xoku()-n2.Xoku()) + (n1.Yoku()-n2.Yoku())*(n1.Yoku()-n2.Yoku()) ); } }
DOGRUT~2 JAV 307 01/06/98

import java.io.*; import nokta;

ww w. ja
([1.0,1.0],[2.0,2.0]) dogru boyu : 1.4142135623730951
DIKDOR~1 JAV 926 01/06/98

import nokta;

public class dikdortgen { protected nokta n1,n2;

//kurucu metod metot girdisi x1,y1,x2,y2 public dikdortgen(double x1, double y1,double x2,double y2) { n1=new nokta(x1,y1); n2=new nokta(x2,y2); } //kurucu metod, method girdisi iki nokta public dikdortgen(nokta nokta1,nokta nokta2) { n1=new nokta(nokta1.x,nokta1.y); n2=new nokta(nokta2.x,nokta2.y);

va
75

public class dogrutesti { public static void main(String args[]) throws IOException { dogru cokdogrubirdogru=new dogru(1.0,1.0,2.0,2.0); System.out.println(cokdogrubirdogru.toString()); System.out.println("dogru boyu : "+cokdogrubirdogru.boy()); } }

dil
22:58 dogrutesti.java 23:22 dikdortgen.java

i.c o

m

}

n2=new nokta(nokta2.x,nokta2.y);

76

} public void dikdortgengir(double x1, double y1,double x2,double y2) { n1.noktagir(x1,y1); n2.noktagir(x2,y2); }

public double alan() { return (n1.Xoku()-n2.Xoku())*(n1.Yoku()-n2.Yoku()); }

}

DIKDOR~2 JAV

345

01/06/98

ww w. ja
NOKTA~1 JAV 423 24/05/98

import java.awt.Graphics; import java.applet.Applet;

public class dikdortgentesti extends Applet { public void paint(Graphics g) { dikdortgen cokguzelbirdikdortgen=new dikdortgen(1,1,2,2); g.drawString(cokguzelbirdikdortgen.toString(),20,20); g.drawString("Alan : "+ cokguzelbirdikdortgen.alan(),20,35); } }
20:42 nokta.java

public class nokta { protected double x, y; public nokta() { noktagir(0,0); }

va
76

dil
23:43 dikdortgentesti.java

public double cevre() { return 2*(n1.Xoku()-n2.Xoku())+ 2*(n1.Yoku()-n2.Yoku()); }

i.c o

public String toString() { return "dikdortgen : ("+n1.toString()+","+n2.toString()+")"; }

m

77

public void noktagir(double a, double b) { x = a; y = b; } public void Xgir(double a) { x = a; } public double Xoku() { return x; } public double Yoku() { return y; }

public String toString() { return "["+x+","+y+"]"; } }
Bu haftaki alıştırmalar:

ww w. ja
ALIŞTIRMA 1

Hesapmakinesi sınıfını yarat. Bu sınıf iki gerçek değişkeni sınıf değişkeni olarak tanımlasın. Topla,cıkar,carp ve bol metodlarını yaz ve bu işlemleri metodların içinde tanımla.

Hesapmakinesitesti konsol programını yaz ve bu sınıf hesapmakinesi sınıfını kullanarak dışarıdan girilen iki gercek sayının dört işlemini hesapla.

public class dortislemhesapmakinasi { private double x1,x2;

public dortislemhesapmakinasi(double y1,double y2) { //kurucu (constructor) metot x1=y1; x2=y2; } public dortislemhesapmakinasi() { //kurucu metot (constructor)

va
77

dil

i.c o

public nokta(nokta n) { noktagir(n.Xoku(),n.Yoku()); }

m

public nokta(double a, double b) { noktagir(a,b); }

78

} public double topla() { return x1+x2; } public double cikar() { return x1-x2; } public double carp() { return x1*x2; } public double bol() { return x1/x2; }

public void ilksayigir(double y1) { x1=y1; }

ww w. ja
} import java.io.*; //giris çikis import Text; import dortislemhesapmakinasi;

public void ikisayigir(double y1,double y2) { x1=y1; x2=y2; }

class dortArtiIslem1 { public static void main (String args[]) throws IOException { dortislemhesapmakinasi h=new dortislemhesapmakinasi(0.0,0.0); double sayi1,sayi2; // DataInputStream cin=new DataInputStream(System.in); System.out.println("Bir sayi giriniz : "); sayi1=Text.readDouble(cin); System.out.println("Ikinci bir sayi giriniz : "); sayi2=Text.readDouble(cin); h.ikisayigir(sayi1,sayi2);

va
78

public void ikincisayigir(double y2) { x2=y2; }

dil

i.c o

m

x1=1; x2=1;

79

} Bir sayi giriniz : 2.5 Ikinci bir sayi giriniz Iki tam sayinin toplami Iki tam sayinin farki Iki tam sayinin carpimi Iki tam sayinin bolumu
JAVA DÖNEM ÖDEVİ 1

: : : : :

3.5 6.0 -1.0 8.75 0.7142857142857143

ww w. ja
değerlendirilecektir.
JAVA ÖRNEK PROBLEMI

int enbuyukortakbolen(int n, int m) { // iki tam sayının en buyuk ortak bolenini hesaplar if(n==0) return m; if(m==0) return n; while(m != n) { if(n>m) n=n-m; else m=m-n; } return n; }

not : sadeleştirme işlemi pay ve paydayı en büyük ortak bölene bölerek yapılır.

Bayagi kesir sınıfının calışmasını kontrol amacıyla bayagikesirtest.java applet programını yaz. Bu programa iki bayağı kesir gir ve dort işlemini hesapla. Süre : 3 Hafta. Bu alıştırma 3 hafta sonra toplanacak ve sizin için

Yukarıdaki ödev problemi yapmanıza yardımcı olmak amacıyla kompleks sınıfı örnek olarak burada verilmiştir. Dönem ödevinde verilen bayagikesir ve burada verilen kompleks sınıfıyla ilgili iki noktaya dikkatinizi çekmek isterim. Birincisi bu iki sınıf şu ana kadar baktığımız diğer sınıflardan farklı olarak sadece size java öğretme amaçlı sınıflar değildir. Bu sınıflar her zaman kütüphanenizde kalabilecek ve gerektiğinde direk olarak gerçek programlarınızda kullanılabilecek özelliklerde sınıflardır. Kompleks sınıfı kompleks değişkenlerd gerektiğinde kullanılabilecek bütün metotları içermektedir.

//=========================================== // kompleks sınıfı tanımı // Dr. Turhan Coban //===========================================

va
79

dil

Bayağı kesirler sanırım ilk okulda sizleri epey zorlamıştır. Daha fazla aklımızı karıştırmalarını önlemek amacıyla bayagikesir sınıfını tanımlayalım. Bu sınıf bayağı kesirlerin dört işlemini ve sadeleştirilmelerini yapabilme kapasitesinde olsun. Aynı zamanda bayağı kesirleri yazdıran toString metodunu da tanımlayalım. Bu metod [2/3] veya 3[5/4] şeklinde bayağı kesirleri yazdırabilsin. Bayağı kesirleri sadeleştirirken en büyük ortak bölen hesabı gerekebilir. Bu amaçla asağıdaki metod sizlere ders hocası tarafından armağan edilmiştir.

i.c o

m

System.out.println("Iki System.out.println("Iki System.out.println("Iki System.out.println("Iki }

tam tam tam tam

sayinin sayinin sayinin sayinin

toplami farki carpimi bolumu

: : : :

"+h.topla()); "+h.cikar()); "+h.carp()); "+h.bol());

80

import java.io.*; // sınıf kompleks // bu sınıf kompleks sayıların matematik // işlemlerini tanımlar // class kompleks { // sınıf degiskenleri double ger; double imaj; // kurucu metodlar public kompleks() { ger=0; imaj=0; }

public kompleks(double numer) { ger=numer; imaj=0; }

public kompleks(kompleks c ) { ger=c.gercek(); imaj=c.imajineri(); } // giriş - çıkış metotları public double gercek() { return ger; }

ww w. ja
public double imajineri() { return imaj; } public void gercekgir(double r) { ger=r; } public void imajinerigir(double i) { imaj=i; } public void kompleksgir(kompleks sag) { ger=sag.gercek(); imaj=sag.imajineri(); 80

va

dil

public kompleks(double nger,double nimaj) { ger=nger; imaj=nimaj; }

i.c o

m

81

} public void kompleksgir(double nr,double ni) { ger=nr; imaj=ni; } public double R() { //kompleks sayinin polar koordinat cap esidi return Math.sqrt(ger*ger+imaj*imaj); }

public double theta() { //kompleks sayinin polar koordinat radyan aci esidi return Math.atan2(imaj,ger); } public double dtheta() { //kompleks sayinin polar koordinat derece aci esidi return Math.atan2(imaj,ger)*45.0/Math.atan(1.0); } public void topla(kompleks sag) { imaj = imaj + sag.imajineri(); ger = ger + sag.gercek(); } public void cikar(kompleks sag) { imaj = imaj - sag.imajineri(); ger = ger - sag.gercek(); }

ww w. ja

public void carp(kompleks sag ) { ger = ger*sag.gercek() - imaj*sag.imajineri(); imaj = ger*sag.imajineri() + imaj*sag.gercek(); } public void bol(kompleks sag ) { double a=ger*ger+imaj*imaj; ger = ( ger*sag.gercek() + imaj*sag.imajineri())/a; imaj = (-ger*sag.imajineri() + imaj*sag.gercek())/a; } public static kompleks topla(kompleks sol, kompleks sag) { // iki kompleks say n n toplam n return deyimiyle kompleks olarak // aktar r double r1=(sol.gercek() + sag.gercek()); double i1=(sol.imajineri() + sag.imajineri()); kompleks sonuc; sonuc=new kompleks(r1,i1); return sonuc; }

va
81

dil

i.c o

m

82

public static kompleks carp(kompleks sol, kompleks sag) { // iki kompleks sayinin carpimini aktar kompleks sonuc; sonuc=new kompleks ((sol.gercek()*sag.gercek() - sol.imajineri()*sag.imajineri()), (sol.gercek()*sag.imajineri() + sol.imajineri()*sag.gercek())); return sonuc; }

ww w. ja

public static kompleks pow(kompleks sol, double sag) { // return sum of two kompleks numbers double Rad,th; Rad=Math.pow(sol.R(),sag); th=sag*sol.theta(); kompleks sonuc; sonuc =new kompleks((Rad*Math.cos(th) ), (Rad*Math.sin(th) ) ); return sonuc; } public boolean kucuktur(kompleks sol,kompleks sag) { // less then comparison of two kompleks numbers return (sol.R() < sag.R()); }

public boolean kucuktur_esittir(kompleks sol,kompleks sag) { // less then and esittir comparison of two kompleks numbers return (sol.R() <= sag.R()); } public boolean buyuktur(kompleks sol,kompleks sag) { // buyuktur then comparison of two kompleks numbers return sol.R() > sag.R(); } public boolean buyuktur_esittir(kompleks sol,kompleks sag) { // buyuktur then and esittir comparison of two kompleks numbers

va
82

dil

public static kompleks bol(kompleks sol, kompleks sag) { // return division of two kompleks numbers double a=sag.gercek()*sag.gercek()+sag.imajineri()*sag.imajineri(); kompleks sonuc; sonuc=new kompleks ((sol.gercek()*sag.gercek() + sol.imajineri()*sag.imajineri())/a, (-sol.gercek()*sag.imajineri() + sol.imajineri()*sag.gercek())/a); return sonuc; }

i.c o

m

public static kompleks cikar(kompleks sol, kompleks sag) { // iki kompleks sayinin sonuclarini aktar kompleks sonuc; sonuc=new kompleks((sol.gercek() - sag.gercek()), (sol.imajineri() - sag.imajineri())); return sonuc; }

83

public boolean esit_degildir(kompleks sol,kompleks { // not esittir comparison of two kompleks numbers return sol.R() != sag.R(); }

ww w. ja

public String toString() { // yazima hazir kompleks formda String degiskeni iletir. String b=""; if(Math.abs(imajineri())!=1) { if(imajineri() > 0) b=b+"("+gercek()+" + "+imajineri()+"i )"; else if(imajineri() <0 ) b=b+"("+gercek()+" - "+(-imajineri())+"i )"; else b=b+gercek()+ " "; } else { if(imajineri() > 0) b=b+"("+gercek()+" + i )"; else if(imajineri() < 0) b=b+"("+gercek()+" - i )"; else b=b+gercek()+" "; } return b; } };

va
83

public static String toString(kompleks value) { String b=""; if(Math.abs(value.imajineri())!=1) { if(value.imajineri() >= 0) b=b+"("+value.gercek()+" + "+value.imajineri()+"i )"; else b=b+"("+value.gercek()+" - "+(-value.imajineri())+"i )"; } else { if(value.imajineri() >= 0) b=b+"("+value.gercek()+" + i )"; else b=b+"("+value.gercek()+" - i )"; } return b; }

dil

i.c o
sag)

public boolean esittir(kompleks sol,kompleks sag) { // esittir comparison of two kompleks numbers return sol.R() == sag.R(); }

m

return sol.R() >= sag.R(); }

84

//kompleks sinifinin tanımının sonu import import import import java.applet.Applet; java.awt.*; java.awt.event.*; kompleks; // java applet sinifini cagir // java pencere kullanma sinifini cagir // java pencereyi dinleme sinifini cagir

ww w. ja

public class H8A1 extends Applet implements ActionListener { // //===================================================== // sinif degiskenleri // bu degiskenler tum sinifa aittir Label kutubasligi1; //Label sinifi degiskeni (nesnesi) kutubasligi1 TextField kutugirdisi1; // Textfield sinifi degiskeni (nesnesi) kutugirdisi1 Label kutubasligi2; //Label sinifi degiskeni (nesnesi) kutubasligi2 TextField kutugirdisi2; // Textfield sinifi degiskeni (nesnesi) kutugirdisi2 TextField kutugirdisi3; // Textfield sinifi degiskeni (nesnesi) kutugirdisi2 TextField kutugirdisi4; // Textfield sinifi degiskeni (nesnesi) kutugirdisi2 kompleks k1; // kompleks degisken k1 kompleks k2; // kompleks degisken k2 //===================================================== // pencereyi baslatma metodu // pencere ilk basladiginda // degiskenler buradaki degerleri alirlar public void init() { k1=new kompleks(); k2=new kompleks(); kutubasligi1=new Label("Birinci kompleks sayiyi giriniz : "); add(kutubasligi1); kutugirdisi1=new TextField(5); kutugirdisi1.addActionListener(this); add(kutugirdisi1); kutugirdisi2=new TextField(5); kutugirdisi2.addActionListener(this); add(kutugirdisi2); kutubasligi2=new Label("Ikinci kompleks say y giriniz : "); add(kutubasligi2); kutugirdisi3=new TextField(5); kutugirdisi3.addActionListener(this); add(kutugirdisi3); kutugirdisi4=new TextField(5); kutugirdisi4.addActionListener(this); add(kutugirdisi4); } //===================================================== // girdi alanindaki olan olaylari dinleme metodu // Her yeni rakam girildiginde bu metod cagirilir public void actionPerformed(ActionEvent e) { Double sayi1=new Double(kutugirdisi1.getText() ); Double sayi2=new Double(kutugirdisi2.getText() ); Double sayi3=new Double(kutugirdisi3.getText() );

va
84

dil

i.c o

m

85

ww w. ja
Java dönem ödevinin çözümü
// kurucu metodlar

//=========================================== // bayagikesir sinifi tanimi // Dr. Turhan Coban //=========================================== import java.io.*; // sinif bayagikesir // bu sinif bayagikesir sayilarin matematik // islemlerini tanimlar // class bayagikesir { // sinif degiskenleri int pay; int payda;

va
85

dil

g.drawString("iki sayinin toplami : "+kompleks.toString(kompleks.topla(k1,k2)),25,110); g.drawString("iki sayinin farki : "+kompleks.toString(kompleks.cikar(k1,k2)),25,125); g.drawString("iki sayinin carpimi : "+kompleks.toString(kompleks.carp(k1,k2)),25,140 ); g.drawString("iki sayinin bolumu : "+kompleks.toString(kompleks.bol(k1,k2)),25,155 ); } }

i.c o

} //===================================================== // paint (boya=pencereye ciz metodu) public void paint(Graphics g) { g.drawString("ilk sayi : "+k1.toString(),25,80); g.drawString("ikinci sayi : "+k2.toString(),25,95);

m

Double sayi4=new Double(kutugirdisi4.getText() ); k1.kompleksgir(sayi1.doubleValue(),sayi2.doubleValue()); k2.kompleksgir(sayi3.doubleValue(),sayi4.doubleValue()); repaint();//pencereyi yeniden paint metoduna gore ciz

86

public bayagikesir(int numer) { pay=numer; payda=1; } public bayagikesir(bayagikesir c ) { pay=c.Pay(); payda=c.Payda(); } // giriŸ - ‡ k Ÿ metotlar

ww w. ja

int enbuyukortakbolen(int n,int m) { // iki tam sayının en buyuk ortak bolenini hesaplar if(n==0) return m; if(m==0) return n; while(m != n) { if(n>m) n=n-m; else m=m-n; } return n; }

public void sadelestir() { //sadelestir : //a) isareti paya tasi; //b) pay ve paydan n ortak en b y k ortak bolenlerini yoket; int sign = 1; if(pay<0) { sign=-1; pay=-pay; } if(payda<0) { sign=-sign; payda=-payda; } if(payda != 0) { int d = enbuyukortakbolen(pay,payda);

va
86

dil

i.c o

public bayagikesir(int npay,int npayda) { pay=npay; payda=npayda; }

m

public bayagikesir() { pay=0; payda=1; }

87

} public int Pay() { return pay; } public int Payda() { return payda; } public void payGir(int r) { pay=r; } public void paydaGir(int i) { payda=i; }

ww w. ja
public void bayagikesirGir(int nr) { pay=nr; payda=1; }

public void bayagikesirGir(int nr,int ni) { pay=nr; payda=ni; }

public void bayagikesirGir(double d) { // tam sayinin bayagikesir esitini y kle // eh birazc k yaklas m var tabi bayagikesirGir((int)d*10000,10000); sadelestir(); } public double toDouble() { //bayagikesir sayinin gercek sayi esidi return ((double)pay/(double)payda); }

va
87

public void bayagikesirGir(bayagikesir sag) { pay=sag.Pay(); payda=sag.Payda(); }

dil

i.c o

m

pay=sign*(pay/d); payda=payda/d; } else { System.out.println("Payda s f ra esittir"); }

88

public void topla(bayagikesir sag) { //ikinci bir bayagikesirle topla pay = pay*sag.Payda() + sag.Pay()*payda; payda = payda*sag.Payda(); } public void topla(int sag) { //bir gercek say yla topla pay = pay + sag*payda; sadelestir(); }

ww w. ja
public void carp(bayagikesir sag ) { //bir bayagikesir sayiyla carp pay = pay*sag.Pay(); payda = payda*sag.Payda(); sadelestir(); } public void carp(int sag ) { //bir gercek sayiyla carp pay = pay*sag; sadelestir(); } public void bol(bayagikesir sag ) { //bir bayagikesir say yla bol pay = pay*sag.Payda(); payda = payda*sag.Pay(); sadelestir(); 88

public void cikar(int sag) { //bir gercek say yla topla pay = pay - sag*payda; sadelestir(); }

va

public void cikar(bayagikesir sag) { //ikinci bir bayagikesirle topla pay = pay*sag.Payda() - sag.Pay()*payda; payda = payda*sag.Payda(); sadelestir(); }

dil

i.c o

public static bayagikesir BayagikesireCevir(double d) { // tam sayinin bayagikesir esiti // eh birazc k yaklas m var tabi bayagikesir b=new bayagikesir(); b.bayagikesirGir((int)d*10000,10000); b.sadelestir(); return b; }

m

89

} public void bol(int sag ) { //bir Pay say yla bol payda = payda*sag; sadelestir(); }

public static bayagikesir topla(bayagikesir sol, bayagikesir sag) { // iki bayagikesir say n n toplam n return deyimiyle bayagikesir olarak // aktar r int r1= sol.Pay() * sag.Payda() + sag.Pay() * sol.Payda(); int i1= sol.Payda()* sag.Payda(); bayagikesir sonuc; sonuc=new bayagikesir(r1,i1); sonuc.sadelestir(); return sonuc; } public static bayagikesir topla(bayagikesir sol, int sag) { // bir bayagikesir ve bir Pay say n n toplam n return deyimiyle bayagikesir olarak // aktar r int r1=sol.Pay() + sag*sol.Payda(); int i1=sol.Payda(); bayagikesir sonuc; sonuc=new bayagikesir(r1,i1); sonuc.sadelestir(); return sonuc; } public static bayagikesir topla(int sol, bayagikesir sag) { // bir bayagikesir ve bir Pay say n n toplam n return deyimiyle bayagikesir olarak // aktar r int r1=sag.Pay() + sol*sag.Payda(); int i1=sag.Payda(); bayagikesir sonuc; sonuc=new bayagikesir(r1,i1); sonuc.sadelestir(); return sonuc; } //=================================== public static bayagikesir cikar(bayagikesir sol, bayagikesir sag) { // iki bayagikesir say n n toplam n return deyimiyle bayagikesir olarak // aktar r int r1= sol.Pay() * sag.Payda() - sag.Pay() * sol.Payda(); int i1= sol.Payda()* sag.Payda(); bayagikesir sonuc; sonuc=new bayagikesir(r1,i1); sonuc.sadelestir(); return sonuc; } public static bayagikesir cikar(bayagikesir sol, int sag)

ww w. ja

va
89

dil

i.c o

m

90

//===================================

ww w. ja

public static bayagikesir carp(bayagikesir sol, int sag) { // bir bayagikesir ve bir double sayinin carpimini aktar bayagikesir sonuc; sonuc=new bayagikesir(sol.Pay()*sag,sol.Payda()); sonuc.sadelestir(); return sonuc; } public static bayagikesir carp(int sol, bayagikesir sag) { // bir bayagikesir ve bir double sayinin carpimini aktar bayagikesir sonuc; sonuc=new bayagikesir(sag.Pay()*sol,sag.Payda()); sonuc.sadelestir(); return sonuc; } public static bayagikesir bol(bayagikesir sol, bayagikesir { // iki bayagikesir sayinin b”l mlerini aktar bayagikesir sonuc; sonuc=new bayagikesir((int)(sol.Pay()*sag.Payda()), (int)(sol.Payda()*sag.Pay())); sonuc.sadelestir(); return sonuc; } public static bayagikesir bol(bayagikesir sol, int sag) sag)

va
90

public static bayagikesir carp(bayagikesir sol, bayagikesir sag) { // iki bayagikesir sayinin carpimini aktar bayagikesir sonuc; sonuc=new bayagikesir(sol.Pay()*sag.Pay(),sol.Payda()*sag.Payda()); sonuc.sadelestir(); return sonuc; }

dil

public static bayagikesir cikar(int sol, bayagikesir sag) { // bir bayagikesir ve bir Pay say n n toplam n return deyimiyle bayagikesir olarak // aktar r int r1=sag.Pay() - sol*sag.Payda(); int i1=sag.Payda(); bayagikesir sonuc; sonuc=new bayagikesir(r1,i1); sonuc.sadelestir(); return sonuc; }

i.c o

{ // bir bayagikesir ve bir Pay say n n toplam n bayagikesir olarak // aktar r int r1=sol.Pay() - sag*sol.Payda(); int i1=sol.Payda(); bayagikesir sonuc; sonuc=new bayagikesir(r1,i1); sonuc.sadelestir(); return sonuc; }

m

return deyimiyle

91

public boolean kucuktur_esittir(bayagikesir sol,bayagikesir sag) { // less then and esittir comparison of two bayagikesir numbers return (sol.toDouble() <= sag.toDouble()); } public boolean buyuktur(bayagikesir sol,bayagikesir sag) { // buyuktur then comparison of two bayagikesir numbers return sol.toDouble() > sag.toDouble(); }

public boolean esittir(bayagikesir sol,bayagikesir sag) { // esittir comparison of two bayagikesir numbers return sol.toDouble() == sag.toDouble(); }

ww w. ja

public boolean esit_degildir(bayagikesir sol,bayagikesir { // not esittir comparison of two bayagikesir numbers return sol.toDouble() != sag.toDouble(); } public static String toString(bayagikesir value) { String b=""; if(Math.abs(value.Payda())!=1) { b=b+"( "+value.Pay()+" / "+value.Payda()+" )"; } else { b=b+value.Pay()+" "; } return b; }

va
91

public boolean buyuktur_esittir(bayagikesir sol,bayagikesir sag) { // buyuktur then and esittir comparison of two bayagikesir numbers return sol.toDouble() >= sag.toDouble(); }

public String toString() { // yazima haz r bayagikesir formda String de§iskeni iletir. String b="";

dil

i.c o
sag)

public boolean kucuktur(bayagikesir sol,bayagikesir sag) { // less then comparison of two bayagikesir numbers return (sol.toDouble() < sag.toDouble()); }

m

{ // bayagikesir say y double say ya bol bayagikesir sonuc; sonuc=new bayagikesir(sol.Pay(),(sol.Payda()*sag)); sonuc.sadelestir(); return sonuc; }

92

Bayagıkesir sınıfı test programı bkTesti
import import import import java.applet.Applet; java.awt.*; java.awt.event.*; bayagikesir;

// java applet sinifini cagir // java pencere kullanma sinifini cagir // java pencereyi dinleme sinifini cagir

ww w. ja

public class bkTesti extends Applet implements ActionListener { // //===================================================== // sinif degiskenleri // bu degiskenler tum s n fa aittir Label kutubasligi1; //Label sinifi degiskeni (nesnesi) kutubasligi1 TextField kutugirdisi1; // Textfield sinifi degiskeni (nesnesi) kutugirdisi1 Label kutubasligi2; //Label sinifi degiskeni (nesnesi) kutubasligi2 TextField kutugirdisi2; // Textfield sinifi degiskeni (nesnesi) kutugirdisi2 TextField kutugirdisi3; // Textfield sinifi degiskeni (nesnesi) kutugirdisi2 TextField kutugirdisi4; // Textfield sinifi degiskeni (nesnesi) kutugirdisi2 bayagikesir k1; // bayagikesir degisken k1 bayagikesir k2; // bayagikesir degisken k2 //===================================================== // pencereyi baslatma metodu // pencere ilk basladiginda // degiskenler buradaki degerleri alirlar public void init() { k1=new bayagikesir(1,2); k2=new bayagikesir(2,4); kutubasligi1=new Label("Birinci bayagikesir sayiyi giriniz : "); add(kutubasligi1); kutugirdisi1=new TextField(5); kutugirdisi1.addActionListener(this); add(kutugirdisi1); kutugirdisi2=new TextField(5); kutugirdisi2.addActionListener(this); add(kutugirdisi2); kutubasligi2=new Label("Ikinci bayagikesir sayiyi giriniz : "); add(kutubasligi2); kutugirdisi3=new TextField(5); kutugirdisi3.addActionListener(this);

va
92

dil

i.c o

if(Math.abs(Payda())!=1) { b=b+"( "+pay+" / "+Payda()+" )"; } else { b=b+Pay()+" "; } return b; } }; //bayagikesir sinifinin taniminin sonu

m

93

ww w. ja
93

va

g.drawString("iki sayinin toplami : "+bayagikesir.toString(bayagikesir.topla(k1,k2)),25,110); g.drawString("iki sayinin farki : "+bayagikesir.toString(bayagikesir.cikar(k1,k2)),25,125); g.drawString("iki sayinin carpimi : "+bayagikesir.toString(bayagikesir.carp(k1,k2)),25,140 ); g.drawString("iki sayinin bolumu : "+bayagikesir.toString(bayagikesir.bol(k1,k2)),25,155 ); } }

dil

add(kutugirdisi3); kutugirdisi4=new TextField(5); kutugirdisi4.addActionListener(this); add(kutugirdisi4); } //===================================================== // girdi alanindaki olan olaylari dinleme metodu // Her yeni rakam girildiginde bu metod cagirilir public void actionPerformed(ActionEvent e) { Integer sayi1=new Integer(kutugirdisi1.getText() ); Integer sayi2=new Integer(kutugirdisi2.getText() ); Integer sayi3=new Integer(kutugirdisi3.getText() ); Integer sayi4=new Integer(kutugirdisi4.getText() ); k1.bayagikesirGir(sayi1.intValue(),sayi2.intValue()); k2.bayagikesirGir(sayi3.intValue(),sayi4.intValue()); repaint();//pencereyi yeniden paint metoduna gore ciz } //===================================================== // paint (boya=pencereye ciz metodu) public void paint(Graphics g) { g.drawString("ilk sayi : "+k1.toString(),25,80); g.drawString("ikinci sayi : "+k2.toString(),25,95);

i.c o

m

94

BÖLÜM 4 : Boyutlu degişken ve nesneler (Arrays)
4.1 Tek boyutlu değişkenler

Değişken_türü değişken_ismi[]; Şeklinde tanımlanır. Bir örnek verecek olursak int ayın_gunleri[];

Değişken_ismi=new Değişken_türü[değişken_boyutu]; Terimi kullanılır. Bunu bir önceki örneğe uygularsak : Ayın_gunleri=new int[12];

Arrayi bir kere tanımladıktan sonra onun içindeki her alt değere indeksi üzerinden ulaşmak mümkündür. Örnegin: ayın_gunleri[0] = 31; ayın_gunleri[1] = 28;

ww w. ja
Class boyut { Public static void main(String args[] ) { int ayin_gunleri[]=new int[12]; ayin_gunler[0]=31; ayin_gunler[1]=28; ayin_gunler[2]=31; ayin_gunler[3]=30; ayin_gunler[4]=31; ayin_gunler[5]=30; ayin_gunler[6]=31; ayin_gunler[7]=31; ayin_gunler[8]=30; ayin_gunler[9]=31; ayin_gunler[10]=30;

gibi. . İndeks değişkeni herzaman sıfırdan başlar.

Küçük bir örnek sınıfta bu kavramı daha açık olarak vermeye çalışalım.

va
94

dil

Bu tanım hernekadar haftanın_gunleri nin boyutlu bir değişken olduğunu belirtiyorsa da kesin boyutunu bildirmemektedir. Boyutlu değişkenin tam boyutunu tanımlamak ve bilgisayar hafızasındaki yerini tam olarak saptamak için

i.c o

Boyutlu değişkenler aynı degişken türü veya sınıf türünden birden fazla nesne veya değişkenin tek bir isimle tanımlanmasıdır. Boyutlu değişkenlere referans indeks numarası kullanılarak ulaşılır. Genel olarak bir boyutlu değişkenler

m

95

} } Şekil 4.1.1 boyut.java programı

Şekil 4.1.3 de boyut kavramının for döngüsüyle birlikte kullanışını görüyorsunuz. Boyutlu değişkenin toplam boyutuna da sayı.length değişkeniyle ulaşabiliriz.
import java.io.*; //java girdi cikti sinifini cagir class Aritmetik2 { public static void main(String args[]) { int sayi[]={10,5,7,9,11,13,14,18}; int toplam=0; int i; for(i=0;i<sayi.length;i++) { toplam+=sayi[i]; } System.out.println("Ortalama = "+toplam/sayi.length); } }

ww w. ja
Şekil 4.1.3 Aritmetik2.java programı
import java.awt.*; import java.applet.Applet; import java.awt.event.*;

Şimdi de bir applet örneğinde tek boyutlu değişkenleri kullanalım. Daha önce zarApplet.java programını incelemiştik. Şimdi bu programa her bir zar yüzeyinin atılış frekanslarını ekleyelim. Toplam altı yüz olduğundan birden altıya kadar her sayının kaç kere geldiğini saydırmamız gerekir. Bunun için bir boyutlu zarfrekansi değişkenini tanımlayacağız. Program listesi ve sonuç appleti Şekil 4.1.4 ve şekil 4.1.5 de görülmektedir.

public class zarfrekansiApplet extends Applet implements ActionListener { int toplamzaratisi=0; int toplam=0; 95

va

dil

Class boyut1 { Public static void main(String args[] ) { int ayin_gunleri[]={31,28,31,30,31,30,31,31,30,31,30,31}; System.out.println(“Nisan ayı “+ayin_gunleri[3]+”gun ceker”); } } Şekil 4.1.2 boyut.java programı

i.c o

Bu programı daha kısa olarak yazmak için Şekil 4.1.2 de görülen şekilde bütün değişkenlerin değerlerini aynı anda tanımlıyabiliriz.

m

ayin_gunler[11]=31; System.out.println(“Nisan ayı “+ayin_gunleri[3]+”gun ceker”);

96

ww w. ja

public void actionPerformed(ActionEvent e) { zar1=zar(); zar2=zar(); ilkzar.setText(Integer.toString(zar1)); ikincizar.setText(Integer.toString(zar2)); toplam+=(zar1+zar2); toplamzaratisi++; // not boyutlu degisken indeksi 0 dan basliyor. zarfrekansi[zar1-1]++; zarfrekansi[zar2-1]++; repaint(); } public void paint( Graphics g) { g.drawString("toplam = "+toplam+" Atilan zar sayisi = "+toplamzaratisi,25,50); for(int i=0;i<6;i++) { g.drawString(zarfrekansi[i]+" kere "+(i+1)+" atildi ",25,(65+15*i)); } } }

va
96

dil

public void init() { //programi baslat zarfrekansi=new int[6]; ilkzar=new TextField(10); // Textfield sinifi ilkzar nesnesini yarat add(ilkzar); // ilk zar nesnesini pencereye ekle ikincizar=new TextField(10);// Textfield sinifi ikincizar nesnesini yarat add(ikincizar); // ikinci zar nesnesini pencereye ekle salla=new Button("Zari salla ve at"); add(salla); salla.addActionListener(this); }

i.c o

public static int zar() { return 1+(int)(Math.random()*6); }

m

TextField ilkzar,ikincizar; Button salla; //zar atma d gmesi int zar1,zar2; int zarfrekansi[];

97

Şekil 4.1.4 ZarfrekansiApplet.html appletinin görünümü 4.2 Tek boyutlu nesne tipi değişkenler

Nesne tipi değişkenler için de aynı normal basit değişkenlerde olduğu gibi boyut tanımı yapılır. Normal boyut tanımı yapıldıktan sonra, boyuttaki her nesne teker teker tanımlanır. Örneğin :
kompleks sayi[]=new kompleks[5]; sayi[0]=new kompleks(1,2); sayi[1]=new kompleks(1,-1); sayi[2]=new kompleks(2,0); sayi[3]=new kompleks(1.1,-0.5); sayi[4]=new kompleks(1,1.5);

ww w. ja
gibi.

dogru3 n[]=new dogru3[3]; n[0]=new dogru3(1,1,1,2,2,2); n[1]=new dogru3(2,2,2,3,3,3); n[2]=new dogru3(3,3,3,4,4,4);

4.3 Çok boyutlu değişkenler

İki ve daha fazla boyutlu değişkenler de tanımlamak mümkündür. İki boyutlu değişkenler en fazla tablo veya matris gibi satır ve sütun olmak üzere iki boyutta gösterilmesi gereken büyüklükleri oluşturmak için kullanılır.Java iki boyutlu değişkenleri direk olarak açamaz. Tek boyutlu değişkenlerin yine tek boyutlu degişkenini açar. Sonuç olarak iki boyut sağlanmış olur. Örnek verecek olursak Int b[][]=new int[3][4]. Genel olarak ilk parantes satır sayısı, ikinci parantez sütun sayısı olarak kabul edilir. Buna göre b değişkenini şöyle düşünebiliriz : b[0][0] b[1][0] b[2][0] b[0][1] b[1][1] b[2][1] b[0][2] b[1][2] b[2][2] b[0][3] b[1][3] b[2][3]

Iki boyutlu değişken de bir boyutlu değişkenlerde olduğu gibi degerleri direk olarak
97

va

dil

i.c o

m

98

Terimi bize aşağıdaki tabloyu tanımlar: 1 3 2 4

b[0][0] b[0][1] b[0][1] b[1][1]

İki boyutlu değişkenlerin kullanılmasını göstermek amacıyla bir örnek problem verelim:
import java.awt.Graphics; import java.applet.Applet; public class ikiboyut extends Applet { // void tipi paint metodu public void paint( Graphics g) { int a1[][]={{1,2,3},{4,5,6}}; int a2[][]={{1,2},{4}}; g.drawString(" a1 : ",25,25); ikiboyutyazdir(a1,g,40); g.drawString(" a2 : ",25,70); ikiboyutyazdir(a2,g,85); }

ww w. ja
}

public void ikiboyutyazdir(int a[][], Graphics g,int y) { int x=25; for(int i=0;i<a.length;i++) { for(int j=0;j<a[i].length;j++) { g.drawString(String.valueOf(a[i][j]),x,y); x+=15; } x=25; y+=15; } }

Şekil 4.3.1 İki boyutlu değişkenler örnegi ikiboyut.java Boyutlara ulaşmak için programdan da görüleceği gibi for döngüsü kullandık. Boyutlu değişkenlere ulaşım. For döngülerinin en çok kullanıldığı yerdir. Satırların boyutuna a.length, sütunların boyutuna ise a[satır].length terimiyle ulaştık. Bu tanım bize toplam satır ve sütun boyutunu direk tanımlar, ve kullanımda yeterince esneklik sağlar.

va
98

dil

i.c o

m

yüklüyebiliriz, ve yükleme sırasında boyutları da tayin edebiliriz. Örneğin : Int b[][] = {{1,2},{3,4}};

99

4.4 boyutlu değişkenlerin metodlara aktarımı Boyutlu değişkenler aynen boyutsuz değişkenler gibi metotlara aktarılırlar. Örneğin eğer int sıcaklık[] = new int[24];

Şekil 4.3.1 İki boyutlu değişkenler örnegi ikiboyut.html doyasının appletviewer ile görünümü

gibi.

Metodların çıktı değişkenleri de çok boyutlu olarak tanımlanabilir ve kullanılabilir. Örneğin :

ww w. ja
gibi.
JAVA PROGRAMLAMA DİLİ HAFTA 8

public static double[][] inversematris(double[][] a)

ARITME~1 JAV NOKTA3~1 JAV

public class nokta3 { protected double x, y, z; //kurucu metodlar public nokta3() { nokta3gir(0,0,0); }

public nokta3(double a, double b,double c) {

va
390 1.054 07/06/98 09/06/98 99

deyimiyle tanımlanan sicaklık; sicakligidegistir(sıcaklik); terimiyle sicakligidegistir metotuna aktarılabilir. Metot tanımlanırken, sıcaklığın boyutlu değişken olduğu tanımlanmalıdır: double void sicakligideğiştir(int sicaklik[]) { .......................... }

dil

18:47 Aritmetik2.java 5:01 nokta3.java

i.c o

m

100

public nokta3(nokta3 n) { nokta3gir(n.Xoku(),n.Yoku(),n.Zoku()); }

public void Xgir(double a) { x = a; } public void Ygir(double b) { y = b; } public void Zgir(double c) { x = c; } public double Xoku() { return x; } public double Yoku() { return y; } public double Zoku() { return z; }

ww w. ja
} public String toString() { return "["+x+","+y+","+z+"]"; } 2.419 09/06/98 DOGRU3~1 JAV public class dogru3

va
5:04 dogru3.java 100

dil

public void nokta3gir(nokta3 in1) { x = in1.x; y = in1.y; z = in1.z; }

i.c o

// giris cikis metodlari public void nokta3gir(double a, double b,double c) { x = a; y = b; z = c; }

m

}

nokta3gir(a,b,c);

101

{

public dogru3(double n1x, double n1y,double n1z, double n2x, double n2y,double n2z) { n1=new nokta3(n1x,n1y,n1z); n2=new nokta3(n2x,n2y,n2z); }

public void dogru3gir(nokta3 in1, nokta3 in2 ) { n1.nokta3gir(in1.x,in1.y,in1.z); n2.nokta3gir(in2.x,in2.y,in2.z); }

ww w. ja
public nokta3 n1oku() { return n1; }

public void n1gir(double x1,double y1,double z1) { n1.nokta3gir(x1,y1,z1); } public void n1gir(nokta3 in1) { n1.nokta3gir(in1.x,in1.y,in1.z); } public void n2gir(double x2,double y2,double z2) { n2.nokta3gir(x2,y2,z2); } public void n2gir(nokta3 in2) { n2.nokta3gir(in2.x,in2.y,in2.z); }

va
101

public void dogru3gir(double x1, double y1,double z1, double x2, double y2,double z2) { n1.nokta3gir(x1,y1,z1); n2.nokta3gir(x2,y2,z2); }

dil

public dogru3(nokta3 na,nokta3 nb) { n1=new nokta3(na.Xoku(),na.Yoku(),na.Zoku()); n2=new nokta3(nb.Xoku(),nb.Yoku(),nb.Zoku()); }

i.c o

public dogru3() { n1=new nokta3(); n2=new nokta3(); }

m

// 3 boyutlu dogru nokta3 n1; nokta3 n2;

102

public double Y() { //dogrunun y koordinat uzunlugu return (n2.Yoku()-n1.Yoku()); } public double Z() { //dogrunun z coordinat uzunlugu return (n2.Zoku()-n1.Zoku()); }

public double aci_n1_xy() { //dogrunun n1 noktasindan x y duzlemindeki ac s return Math.atan2(Y(),X()); }

public double aci_n1_xz() { // dogrunun n1 noktas ndan x z duzlemindeki ac s // radyan return Math.atan2(Z(),X()); }

ww w. ja
} DORTIS~1 JAV H8A1~1 JAV KOMPLE~1 JAV 660 3.202 7.350 24/05/98 08/06/98 09/06/98

public double aci_n1_yz() { //dogrunun n1 noktas ndan y z duzlemindeki ac s //radyan return Math.atan2(Z(),Y()); } public double R() { //dogrunun boyu return Math.sqrt(X()*X()+Y()*Y()+Z()*Z()); } public String toString() { return "n1: "+n1.toString()+"n2: "+n2.toString(); }

va
102

dil
20:19 dortislemhesapmakinasi.java 22:03 H8A1.java 5:35 kompleks.java

i.c o

public double X() { //dogrunun x koordinat uzunlugu return (n2.Xoku()-n1.Xoku()); }

m

public nokta3 n2oku() { return n2; }

103
Bu haftaki alıştırmalar:

Sizin için kompleks sınıfı yaratılmış ve bu sınıfın nasıl kullanıldığını açıklayan H8A1 applet programı verilmiştir. Bu iki programı incele. Ayrıca Aritmetik2 programını incele ve boyutlu değişkenlerin kullanımını öğren. Sonra 5 kompleks sayının toplamını hesaplayan bir konsol programı yaz.

Ortalama = (1.22 + 0.4i )

import java.io.*; //java girdi cikti sinifini cagir import kompleks;

ww w. ja

class H8A1a { public static void main(String args[]) throws IOException { kompleks sayi[]=new kompleks[5]; double n1,n2; kompleks toplam=new kompleks(); int i; DataInputStream cin=new DataInputStream(System.in); for(i=0;i<sayi.length;i++) { System.out.println("bir kompleks sayi giriniz : "); n1=Text.readDouble(cin); n2=Text.readDouble(cin); sayi[i]=new kompleks(n1,n2); toplam.topla(sayi[i]); } toplam.bol((double)sayi.length); System.out.println("Ortalama = "+toplam.toString()); } }

va
103

class H8A1 { public static void main(String args[]) { kompleks sayi[]=new kompleks[5]; sayi[0]=new kompleks(1,2); sayi[1]=new kompleks(1,-1); sayi[2]=new kompleks(2,0); sayi[3]=new kompleks(1.1,-0.5); sayi[4]=new kompleks(1,1.5); kompleks toplam=new kompleks(); int i; for(i=0;i<sayi.length;i++) { toplam.topla(sayi[i]); } toplam.bol((double)sayi.length); System.out.println("Ortalama = "+toplam.toString()); } }

dil

i.c o

import java.io.*; //java girdi cikti sinifini cagir import kompleks;

m

ALIŞTIRMA 1

104

ALIŞTIRMA 2

Üç boyutlu nokta ve doğru tanımları nokta3 ve dogru3 sınıflarında verilmiştir. 3 tane dogruyu boyutlu değişken olarak H9A2 sınıfında tanımlayın ve dogruların toplam boylarını ve baslangıç noktasının xy xz ve yz düzlemlerinde yaptığı açıları derece cinsinden yazdırın.

import java.io.*; //java girdi cikti sinifini cagir import kompleks;

ww w. ja
n1: aci aci aci n1: aci aci aci n1: aci aci aci

[1.0,1.0,1.0]n2: [2.0,2.0,2.0]boy : 1.7320508075688772 xy = 0.7853981633974483 xz = 0.7853981633974483 yz = 0.7853981633974483 [2.0,2.0,2.0]n2: [3.0,3.0,3.0]boy : 1.7320508075688772 xy = 0.7853981633974483 xz = 0.7853981633974483 yz = 0.7853981633974483 [3.0,3.0,3.0]n2: [4.0,4.0,4.0]boy : 1.7320508075688772 xy = 0.7853981633974483 xz = 0.7853981633974483 yz = 0.7853981633974483

va
104

class H8A2 { public static void main(String args[]) { dogru3 n[]=new dogru3[3]; n[0]=new dogru3(1,1,1,2,2,2); n[1]=new dogru3(2,2,2,3,3,3); n[2]=new dogru3(3,3,3,4,4,4); int i; for(i=0;i<n.length;i++) { System.out.println(n[i].toString()+"boy : "+n[i].R()); System.out.println("aci xy = "+n[i].aci_n1_xy()); System.out.println("aci xz = "+n[i].aci_n1_xz()); System.out.println("aci yz = "+n[i].aci_n1_yz()); } } }

dil

i.c o

m

bir kompleks sayi bir kompleks sayi bir kompleks sayi bir kompleks sayi bir kompleks sayi Ortalama = (3.0 +

giriniz giriniz giriniz giriniz giriniz 3.0i )

: : : : :

1 2 3 4 5

1 2 3 4 5

105

5.1 Abstract sınıf

Kavramı daha iyi verebilmek için bir örnek problem oluşturalım. Daha önce sınıf kavramını açıklarken kullandığımız nokta,daire sınıflarını hatırlıyacaksınız. Şimdi bu sınıfların üzerine sekil isimli bir abstract sınıf ekleyerek tekrar oluşturalım.
public abstract class sekil { public double alan() {return 0.0;} public double hacim() {return 0.0;} public abstract String isimOku(); }

Şekil 5.1.1 Abstract sınıf sekil (sekil.java dosyasında yer alıyor)
import sekil;

public class nokta extends sekil { protected double x, y;

ww w. ja
public double Xoku() { return x; } public double Yoku() { return y; } public String toString() { return "["+x+","+y+"]"; }

public nokta(double a, double b) { noktagir(a,b); }

public void noktagir(double a, double b) { x=a; y=b; }

va
105

dil

i.c o

Üçüncü bölümde sınıfların diğer sınıflardan kalıtım (Inheritance) yoluyla türetilmesini görmüştük. Sınıfları kalıtım yoluyla birbirinden türetirken eğer ortak özellikli sınıflar yaratıyorsak, bütün bu sınıf gurubunun en tepesine abstract bir sınıf koyabiliriz. Abstract sınıf diğer sınıfların kullanılmasında extends yoluyla superclasslik etmek ve bütün alt sınıflara ortak bir adres çıkış noktası sağlamak dışında bir görevi yoktur. Diğer bir deyimle bu sınıflar hiçbir zaman doğrudan kullanılmazlar. Ancak alt sınıflarından birini referand olarak göstermek ve onlara dolaylı yoldan ulaşmak amacıyla kullanılırlar.

m

BÖLÜM 5 : SINIFLARDA HİYERARSİ, ABSTRACT SINIF VE İNTERFACE

106

}

Şekil 5.1.2 Abstract sınıf sekilden kalıtımla türetilen nokta sınıfı

import nokta; public class daire extends nokta { protected double yaricap;

public daire(double r, double a, double b) { super(a,b); yaricapgir(r); }

ww w. ja
public double yaricapoku() { return yaricap; } public String isimOku() { return "Daire"; } }

public void yaricapgir(double r) { if(r >= 0.0) yaricap=r; else yaricap=0.0; }

public double alan() { return 3.14159*yaricap*yaricap; } public String toString() { return "Merkez = "+"["+x+","+y+"]"+ "; Yaricap="+yaricap; }

va
106

dil

public daire() { //daire kal t m yaptigi nokta s n f n n kurucu metodunu // super deyimi ile cagirabilir. super(0,0); yaricapgir(0); }

i.c o

m

public String isimOku() { return "Nokta"; }

107

Şekil 5.1.3 sınıf noktadan kalıtımla türetilen daire sınıfı
import daire;

}

Şekil 5.1.4 sınıf daireden kalıtımla türetilen silindir sınıfı
import java.awt.Graphics; import java.applet.Applet;

ww w. ja
public void init() { n = new nokta(7,11); d = new daire(3.5,22,8); s = new silindir(10,3.3,10,10); a = new sekil[3]; a[0]=n; a[1]=d; a[2]=s; }

public class abstracttesti extends Applet { private nokta n; private daire d; private silindir s; private sekil a[];

public void paint(Graphics g) { //direk cag rma : g.drawString(n.isimOku()+": "+n.toString(),25,25); g.drawString(d.isimOku()+": "+d.toString(),25,40); g.drawString(s.isimOku()+": "+s.toString(),25,55); //indirek cag rma

va
107

dil

public double alan() { return 2* super.alan()+ 2*Math.PI*yaricap*yukseklik; } public double hacim(){return super.alan()*yukseklik;} public String toString() {return super.toString()+";yukseklik="+yukseklik;} public String isimOku(){return "Silindir";}

i.c o

public class silindir extends daire { protected double yukseklik; public silindir(){ yukseklikoku(0);} public silindir( double h, double r, int a, int b){ super(r, a, b ); yukseklikoku( h);} public void yukseklikoku (double h ) { if(h>=0) yukseklik=h; else yukseklik=0; } public double yukseklikoku(){return yukseklik;}

m

108

Şekil 5.1.5 Abstract sınıf ve indirek referanslamayı test eden abstractTesti sınıfı

Şekil 5.1.5 Abstract sınıf ve indirek referanslamayı test eden abstractTesti sınıfının sonuclarının applet de görülmesi Örnekten de görüldügü gibi nokta, daire ve silindir abstract sekil sınıfının alt sınıfları olarak oluşturulmuş, ve aynı zamanda bu sınıflara indirek referans olarak kullanılmıştır. Diğer bir deyimle nokta daire ve silindirin adresleri sekil sınıfı nesneye aktarılmış ve bu nesne üzerinden üç sınıfta indirek olarak kullanılmıştır. Bu indirek kullanımın bize temel faydası, Programımıza yeni sınıflar eklediğimizde daha kolay ve az program değiştirerek uyumu sağlayabilme yeteneğidir. Orneğin yukarıdaki program sınıfları durubuna koni eklemek istersekbütün yapacağımız koni sınıfını tanımladıktan sonra, sekil nesnesi a nın boyutunu bir arttırarak aynı hesaplamaya koniyide ilave etmekten ibaret olacaktır. Bu tür uygulamalar bilgisayar kodunun değişim gereksinimini minimuma indirgediğinden nesne kokenli bilgisayar programcılığının onemli uygulamalarından biridir. 5.2 Interface

ww w. ja

abstract sınıfların dezavantajı sadece bir sınıfınkalıtım yoluyla ve extends sozcüğü kullanılarak bağlanabilir olmasıdır. Ve eğer başka bir sınıf halihazırda o sınıfa kalıtım yoluyla bağlanmışsa, bizim yeni bir sınıfı üst sınıf olarak kullanma olasılığımız yok olmuş demektir. Fakat bazı uygulamalar için bu gerekebilir.Bu zaman interface kullanırız. Interface de abstract sınıf gibi kendi içinde bir işlem yapmaz. Sadece öbür sınıfların bağlanmasını teşkil eden bir adres noktası olarak iş görür. İnterface’i bir başka sınıfa bağlamak gerektiğinde extends yerine implements sözcüğü kullanılır. Örnek olarak bir önceki problemi interface ile tanımlıyalım.

va
108

dil

i.c o

} }

m

int y=85; for(int i=0;i<a.length;i++) { g.drawString(a[i].isimOku()+": "+a[i].toString(),25,y); y+=15; g.drawString("Alan : "+a[i].alan()+" Hacim : "+a[i].hacim(),25,y); y+=15; }

109

import sekil; public class nokta implements sekil { protected double x, y; public nokta(double a, double b) { noktagir(a,b); }

public double Yoku() { return y; }

ww w. ja
public String toString() { return "["+x+","+y+"]"; } public String isimOku() { return "Nokta"; } }

public double alan() {return 0.0;}

public double hacim() {return 0.0;}

Şekil 5.2.2 interface sekilden implements kelimesiyle türiyen nokta sınıfı (nokta.java dosyasında yer alıyor)

Görüldüğü gibi burada nokta sınıfının bir öncekinden farkı implements kelimesinin kullanılmış olaması ve bos alan ve hacim metodlarının bu dosyada yazılmasının gerekmesinden ibarettir. Daire ve silindir sınıflarında bir fark mevcut degildir. İki seklin işlemsel sonuçları arasında da bir fark mevcut değildir.

va
109

public double Xoku() { return x; }

dil

public void noktagir(double a, double b) { x=a; y=b; }

i.c o

Şekil 5.2.1 interface sekil (sekil.java dosyasında yer alıyor)

m

public interface sekil { double alan(); double hacim(); String isimOku(); }

110

JAVA PROGRAMLAMA DİLİ HAFTA 9

ALIŞTIRMA 1

ALIŞTIRMA 2

Derste gördüğümüz interface sekil,nokta,daire, silindir sınıflarını ve ilave olarak küre sınıfını yaratınız. Bu sınıfların sekiltesti.java test sınıfında alanlarını ve hacimlerini sekil referansını kullanarak yazdırınız.

ww w. ja
110

va

dil

i.c o

Derste gördüğümüz abstract class sekil,nokta,daire, silindir sınıflarını ve ilave olarak koni sınıfını yaratınız. Bu sınıfların sekiltesti.java test sınıfında alanlarını ve hacimlerini sekil referansını kullanarak yazdırınız.

m

111

BÖLÜM 6 : GRAFİKLER, FONTLAR VE RENKLER

Java appletlerinde çizim yaparken ilk hatırlamamız gereken şey, coordinat merkezinin ekranın sol üst köşesi olduğudur. X ekseni aşağı doğru, Y ekseni sola doğru gider.

Y ekseni

6.1 Graphics sınıfı

ww w. ja
Public void paint (Graphics g) Public void repaint() Bu metodların tanımları şu şekilde verilmiştir.

Graphics sınıfı gafik çizimi için gerekli olan bir çok metodu içinde barındırır. Grafik sınıfı Applet sınıfının alt sınıflarındandır. Bu yüzden applet sınıfının alt sınıfı olan (extends applet ) Her sınıfta direk olarak tanımlıdır. Grafik çizme amacıyla genellikle Graphics sınıfından bir nesne paint metodunun içinde çağırılır. Paint metodunun tanımı şöyledir

Paint metod genellikle applet metodu tarafından otomatik olarak applet ilk açıldığında çağırılır. Tekrar çağırılması gerektiğinde ise repaint metodu çağırılır ve repaint metodu üzerinden indirek olarak paint metodu çağırılır. Repaint metodu

Şeklinde tanımanmıştır. Normal grafik çizdirme metodlarımızı paint metodumuzun içerisinde tanımlanan Graphics sınıfı nessneleri kullanarak yapacağız.

6.1.1 drawString, drawChars ve drawBytes metodları

public abstract void drawString( String stringYazı, int x,int y)

va
111

Y ekseninin alta doğru gitmesi konsol programlarında satırların alta dogru ilerlemesi gibi tarihi bir nedene dayanmaktadır. Bütün bilgisayar grafik programlamasında standartdır.

dil

X ekseni

i.c o

Daha önce applet çizerken java.awt kütüphanesindeki grafik (Graphics) sınıfını kullanmıştık. Ve grafik (Graphics) sinifinina ait drawString metotunu kullanarak applete yazı yazdırmıştık. Şimdi bu sınıfın diğer özelliklerini ve metodlarını öğreneceğiz. Graphics sınıfı, yazı yazma, çizgi çizme, dikdörtgen, oval çizme gibi bir dizi metodu barındırır. Bunun dışında awt kütüphanesinin önemli bir sınıfı da Color sınıfıdır. Color sınıfı rekleri tanımlar ve değişik renklerin kullanımına imkan verir. Font sınıfı grafikte kullanılan yazıların fontlarının (yazı tipinin ve boyutunun) belirlenmesi amacıyla kullanılır. FontMetrics sınıfı fontların boyutlarının belirlenmesiyle ilgili metodları içerir. Polygon sınıfı polygon çizimiyle ilgili metodları barındırır.

m

112

drawString metodu bir string değişkenini verilen x ve y koordinatlarından başlayarak çizer. DrawChars bir boyutlu Char tipi değişken dizisini başlangiçindeksi indeksinden baslayarak yazılacakharfsayısı kadar kısmını x ve y koordinatlarından başlıyarakçizer. DrawByte metodu da drawChars metodu gibidir tek değişikliği Byte türü boyutlu değişken kullanmasıdır. Şekil 6.1.1.1 de bu metodların kullanılmasını açıklayan bir program verilmiştir.
import java.applet.Applet; import java.awt.*;

public class ciz extends Applet { private String s ="Bunu drawString Metoduyla yazdir"; private char c[]={'c','h','a','r','s',' ','8'}; private byte b[]={'b','y','t','e',55,56,57}; public void paint(Graphics g) { g.drawString(s,100,25); g.drawChars(c,2,3,100,50); g.drawBytes(b,0,5,100,75); } }

Şekil 6.1.1.1 drawString drawChars drawBytes metodlarını kullanan ciz programı

ww w. ja
6.2 Renk kontrolü

Şekil 6.1.1.1 drawString drawChars drawBytes metodlarını kullanan ciz programının Applet çıktısı

appletlerde renk controlu Color sınıfını kullanarak yapılır. Renk olusumunda monitör ve Tv de kullnılan RGB (Red-Green-Blue=Kırmızı-Yesil-Mavi) sistemi temel alınır. Bu üç renk monitorde 0-255 arası değerler alabilir. Üç rengin karışımı toplam 256*256*256 renk
112

va

dil

i.c o

public void drawBytes( byte byteYazı[], int başlangıçindeksi,int yazılacakharfsayısı, int x,int y)

m

public void drawChars( char charYazı[], int baslangıçindeksi,int yazılacakharfsayısı, int x,int y)

113

metotları ve rengi değiştirebildiğimiz public abstract Color setColor(Color c) metodu mevcuttur.

import java.awt.*; import java.applet.Applet;

ww w. ja

public void paint(Graphics g) { // yazının rengi 100,255,125 olarak alındı g.setColor(new Color(kirmizi,yesil,mavi)); g.drawString("ABCDEFGHIJKLMNOPQRSTUVWXYZ",50,33); showStatus("Su andaki renk : "+g.getColor()); } }

Bu programda kirmizi değeri 100, yesil değeri 255 ve mavi degeri de 125 alınmış ve setColor deyimiyle yeni renk tanımlanmıştır. Arka plan rengi ise public void setBackground(Color c)

va
113

public class Renk extends Applet { private int kirmizi,yesil,mavi; public void init() { kirmizi=100; yesil=255; mavi=125; // arka palanın rengi mavi olarak veriliyor setBackground(new Color(0,0,255)); }

dil

Applette renk değiştirdiğimiz küçük bir örnek program yazalım :

i.c o

public int getRed() // Kırmızı tonunu oku public int getGreen()//Yesil tonunu oku public int getBlue()//Mavi tonunu oku public abstract Color getColor() //rengi oku

m

tanımlar. Color sınıfı kurucu metodları şu şekilden tanımlanır. public Color( int kirmizi,int yesil,int mavi) //her renk 0-255 arası public Colot(float kirmizi,float yeşil,float mavi) //her renk 0.0-1.0 arası Color sınıfında ayrıca renk degerlerini okuyabildiğimiz

114

Metotunu kullanarak maviye dönüştürülmüştür. 6.3 Yazı Kontrolu

Appletlerde yazı kontrolu Font sınıfını kullanarak yapılır. Şekil 5.3.1 de java 1.1.5 de kullanılabilecek tüm yazı stillerinin (font) listesini veren stil.java programını görüyoruz.
import java.applet.*; import java.awt.*;

Şekil 6.3.1 stil.java programı, java kütüphanesinde mevcut olan yazı sitillerini gösterir

ww w. ja
public final static int BOLD public static int ITALIC

Şekil 6.3.2 stil.java programı, java kütüphanesinde mevcut olan yazı sitillerini gösterir applet programının sonuçları.

Bu yazı sitillerinden birisi asağıda verilen yazı tiplerinden birisiyle beraber ve verilen belli bir yazı boyutunda gösterilebilir. public final static int PLAIN : düz yazı sitili : Kalın yazı sitili : İtalik (yatık) yazı sitili

bu tanımlardaki final sözcüğü bu ifadelerin değişken değil sabit olduğunu gösterir.Font sınıfının kurucu metodu şu şekildedir.

va
114

dil

public class stil extends Applet { public void paint(Graphics g) { String stilListesi[]; stilListesi=getToolkit().getFontList(); int y=15; for(int i=0;i<stilListesi.length;i++) { g.drawString(stilListesi[i],15,y); y+=15; } } }

i.c o

m

115

Public Font( String s, int yazı_sitili, int harf_boyutu); Bir appletin yazı sitili Graphics sınıfındaki setFont metoduyla değiştirilebilir. Public abstract void setFont(Font f) Örnek olarak aşağıdaki deyimi verebiliriz : g.setFont(new Font(“Serif”,Font.BOLD,12);

Şimdi setFont metotunu küçük bir örnekte kullanarak gösterelim :
import java.awt.*; import java.applet.Applet; public class RenkFont extends Applet { private int kirmizi,yesil,mavi; public void init() { kirmizi=100; yesil=255; mavi=125; }

ww w. ja
6.4 Çizgi çizimi

}

Şekil 6.3.3 RenkFont.java programı, java kütüphanesindeki Font uygulamasını gösterir

Şekil 6.3.4 RenkFont.html programı, java kütüphanesindeki Font uygulamasını gösterir

Javada çizgi çizmek için kullanılan temel metot drawLine metodudur. Bu metod Graphics sınıfında tanımlanmıştır. Kurucu metodu : Public abstract void drawLine( int x1, // ilk noktanın x koordinatı

va
115

public void paint(Graphics g) { g.setColor(new Color(kirmizi,yesil,mavi)); setBackground(new Color(0,0,255)); g.setFont(new Font("TimesRoman",Font.BOLD,36)); g.drawString("ABCDEFGHIJKLMNOPQRSTUVWXYZ",50,33); showStatus("Su andaki font : "+g.getFont()); }

dil

i.c o

m

116

public class cizgiciz extends Applet { public void paint(Graphics g) { g.setColor(new Color(0,255,255)); g.setFont(new Font("SansSerif",Font.PLAIN,24)); g.drawLine(10,10,230,95); } }

Şekil 6.4.1 Çizgi çizim örneği cizgiciz.java ve çizginin appletde görünümü 6.5 Dikdörtgen çizimi

ww w. ja

Javada dikdörtgen çizmek için kullanılan temel metot drawRect metodudur. Bu metod Graphics sınıfında tanımlanmıştır. Bu metotların tanımı : Public abstract void drawRect( int x1, // üst tepe noktanın x koordinatı int y1, // üst tepe noktanın y koordinatı int en, // dikdörgenin genişliği int yukseklik) // dikdörtgenin yüksekliği Bu metoda ilave olarak dikdörtgenin içini verilen renkte boyayan Public abstract void fillRect( int x1, // üst tepe noktanın x koordinatı int y1, // üst tepe noktanın y koordinatı int en, // dikdörgenin genişliği int yukseklik) // dikdörtgenin yüksekliği ve dikdörtgeni arkaplan renginde boyayan (silen) Public abstract void clearRect( int x1, // üst tepe noktanın x koordinatı int y1, // üst tepe noktanın y koordinatı int en, // dikdörgenin genişliği int yukseklik) // dikdörtgenin yüksekliği

va
116

dil

i.c o

import java.applet.Applet; import java.awt.*;

m

int y1, //ilk noktanın y koordinatı int x2, // ikinci noktanın x koordinatı int y2) //ikinci noktanın y koordinatı Bir küçük örnek problemde metodu kullanalım :

117

metotları mevcuttur. DrawREct ve fillRec metodunun kullanımı Şekil 5.5.1 de verilmiştir.
import java.applet.Applet; import java.awt.*; public class dikdortgenCiz extends Applet { public void paint(Graphics g) { g.setColor(new Color(255,0,0)); g.drawRect(10,10,100,50); g.fillRect(129,10,100,50); } }

Şekil 6.5.1 dikdortgenCiz.java programı ve dikdortgenCiz.html appleti

ww w. ja
import java.applet.Applet; import java.awt.*;

Public abstract void drawRoundRect( int x1, // üst tepe noktanın x koordinatı int y1, // üst tepe noktanın y koordinatı int en, // dikdörgenin genişliği int yukseklik, // dikdörtgenin yüksekliği int koseeni, // yuvarlak kosenin eni int koseyuksekligi )// yuvarlak kosenin yuksekligi Bu metoda ilave olarak dikdörtgenin içini verilen renkte boyayan Public abstract void fillRoundRect( int x1, // üst tepe noktanın x koordinatı int y1, // üst tepe noktanın y koordinatı int en, // dikdörgenin genişliği int yukseklik, // dikdörtgenin yüksekliği int koseeni, // yuvarlak kosenin eni int koseyuksekligi )// yuvarlak kosenin yuksekligi

public class yuvarlakKoseliDikdortgenCiz extends Applet { public void paint(Graphics g) { g.setColor(new Color(0,0,255)); g.setFont(new Font("SansSerif",Font.PLAIN,12)); g.drawRoundRect(10,10,100,100,15,15); g.fillRoundRect(120,10,100,100,15,15);

va
117

Köşeleri yuvarlatılmış dikdörtgen çizmek içinse drawRoundRect metodu kullanılır

dil

i.c o

m

118

Şekil 6.5.2 yuvarlakKoseliDikdortgenCiz.java programı ve appleti

ww w. ja
import java.applet.Applet; import java.awt.*; } }

Public abstract void fill3DRect( int x1, // üst tepe noktanın x koordinatı int y1, // üst tepe noktanın y koordinatı int en, // dikdörgenin genişliği int yukseklik, // dikdörtgenin yüksekliği boolean yukarıkaldırma) // yukarı kalkık 3üncü boyut

public class ucBoyutluDikdortgenCiz extends Applet { public void paint(Graphics g) { g.setColor(Color.yellow); g.setFont(new Font("SansSerif",Font.PLAIN,12)); g.draw3DRect(10,10,100,100,true); g.fill3DRect(120,10,100,100,true); g.draw3DRect(10,120,100,100,false); g.fill3DRect(120,120,100,100,false);

va
118

Public abstract void draw3DRect( int x1, // üst tepe noktanın x koordinatı int y1, // üst tepe noktanın y koordinatı int en, // dikdörgenin genişliği int yukseklik, // dikdörtgenin yüksekliği boolean yukarıkaldırma) // yukarı kalkık 3üncü boyut

dil

Ayrıca 3 boyutlu dikdortgen çizen draw3DRect ve fill3Drect metotları mevcutttur. Bu metotların tanımları şu şekilde verilmiştir.

i.c o

m

} }

119

Şekil 6.5.3 ucBoyutluDikdortgenCiz.java programı ve appleti 6.6 Oval ve açılı oval çizimi

Oval çizimi için drawOval ve fillOval metodları kullanılır bu metodların tanımı şöyledir : Public abstract void drawOval( int x1, int y1, int en, int yukseklik) Public abstract void fillOval( int x1, int y1, int en, int yukseklik) // üst tepe noktanın x koordinatı // üst tepe noktanın y koordinatı // ovalin genişliği // ovalin yüksekliği

ww w. ja
(x1,y1)
boy en

(x1,y1) koordinatının ovalle ilişkisini daha iyi anlayabilmek için aşağıdaki grafiği verebiliriz :

Şekil 6.6.1 Oval tanımı koordinat sistemi

Oval programını küçük bir örnek programda kullanalım :
import java.applet.Applet;

va
119

dil

// üst tepe noktanın x koordinatı // üst tepe noktanın y koordinatı // ovalin genişliği // ovalin yüksekliği

i.c o

m

120

import java.awt.*; public class daireCiz extends Applet { public void paint(Graphics g) { g.setColor(new Color(0,0,255)); g.drawOval(10,10,50,50); g.fillOval(70,10,50,50); } }

Şekil 6.6.2 daireCiz.java programı ve apleti

ww w. ja
import java.applet.Applet; import java.awt.*; public class arcCiz extends Applet { public void paint(Graphics g) { g.setColor(new Color(0,0,255));

Public abstract void drawArc( int x1, // üst tepe noktanın x koordinatı int y1, // üst tepe noktanın y koordinatı int en, // ovalin genişliği int yukseklik, // ovalin yüksekliği int başlangıçaçısı, //arkın başlangıç açısı, derece int çizimaçısı) // arkın çizim açısı, derece

Public abstract void fillArc( int x1, // üst tepe noktanın x koordinatı int y1, // üst tepe noktanın y koordinatı int en, // ovalin genişliği int yukseklik, // ovalin yüksekliği int başlangıçaçısı, //arkın başlangıç açısı, derece int çizimaçısı) // arkın çizim açısı, derece Şimdi de bu metotu kullanan bir bilgisayar programı yazalım :

va
120

Eğer bir ovalin tamamını değilde sadece bir bölümünü çizmek dilenilirse, drawArc ve fillArc metotları kullanılabilir. Bu metotların tanımı :

dil

i.c o

m

121

Şekil 6.6.3 arcCiz.java programı ve apleti 6.7 Polygon çizimi

Açık ve kapalı polygon şekilleri çizmek için drawPolygon ve fillPolygon metotları kullanılır. Metotların tanımı : public abstract void drawPolygon( int x[], // x koordinat vektörü int y[], // y koordinatı vektörü int nokta sayısı) // nokta sayısı public abstract void drawPolyline( int x[], // x koordinat vektörü int y[], // y koordinatı vektörü int nokta sayısı) // nokta sayısı

ww w. ja
public Polygon() //Polygon sınıfı public Polygon( Örnek olarak üçgen çizen bir program verelim :
import java.applet.Applet; import java.awt.*;

public abstract void drawPolygon( Polygon p) //Graphics sınıfı metodu

Metot tanımlarından görüldüğü gibi polygon int türü vektörle çizilebileceği gibi bu vektörü içinde barındıran Polygon sınıfı bir nesne kullanılarak ta çizilebilir.

public class ucgenCiz extends Applet { public void paint(Graphics g) { int x[]={10,(int)(10+100*Math.cos(Math.PI/3.0)),110,10}; 121

va

int x[], // x koordinat vektörü int y[], // y koordinatı vektörü int nokta sayısı) // nokta sayısı

dil

i.c o

m

g.setFont(new Font("SansSerif",Font.PLAIN,12)); g.drawOval(70,10,50,50); g.drawArc(10,10,50,50,30,60); g.fillArc(70,10,50,50,30,60); } }

122

Şekil 6.7.1 ucgenCiz.java programı ve apleti 6.8 Resim gösterimi

ww w. ja
import java.applet.Applet; import java.awt.*;

Java dili sadece .gif ve .jpg standartlarındaki resimleri gösterebilir. Bu standartlar internet ortamından kaynaklanmaktadır. Resim önce getImage metoduyla bir Image sınıfı nesneye yuklenir, sonra drawImage metoduyla gösterilir. Orneğin Image resim=getImage(getDocumentBase(),”resim.gif”); Ve resim g.drawImage(resim,1,1,this); deyimiyle çizilir. Burada ikinci ve üçüncü noktalar başlangıç x ve y koordinatlarıdır.Son olarak this resmin çizileceği appletin içinde bulunulan sınıfın appleti olduğunu belirtmektedir.

Bir örnek problemle resim çizimini biraz daha belirgin hale getitelim :

public class resim extends Applet { private Image bebek; public void init() { bebek=getImage(getDocumentBase(),"turhan.gif"); } public void paint(Graphics g) { g.drawImage(bebek,1,1,this); // resmi orijinalinin iki kat boyunda ciziniz int en=bebek.getWidth(this); int yukseklik=bebek.getWidth(this); g.drawImage(bebek,1,90,en*2,yukseklik*2,this); }

va
122

dil

i.c o

int y[]={100,(int)(100-100*Math.sin(Math.PI/3.0)),100,100}; int x1[]={130,(int)(130+100*Math.cos(Math.PI/3.0)),230,130}; int y1[]; y1=y; g.setColor(new Color(0,0,255)); g.drawPolygon(x,y,4); g.fillPolygon(x1,y1,4); } }

m

123

}

ww w. ja
JAVA PROGRAMLAMA DİLİ
HAFTA 10

CIZ~1

JAV

import java.applet.Applet; import java.awt.*;

public class ciz1 extends Applet { private String s ="Bunu drawString Metoduyla yazdir"; private char c[]={'c','h','a','r','s',' ','8'}; private byte b[]={'b','y','t','e',75,76,77}; public void init() { Color c=new Color(0,0,255); setBackground(c); }

va
459 16/06/98 1:40 ciz1.java 123

dil

i.c o

m

124

CIZGIC~2 JAV PLOT~1 JAV

251 8.987

16/06/98 16/06/98

ww w. ja

public class Plot { String label; String xlabel; String ylabel; String filename; double xmax,xmin,ymax,ymin; int xabsmin,yabsmin,abswidth,absheight; int nmax; int nline; double x[][]; double y[][]; int n[]; line int red[],green[],blue[]; int plottype[]; int xgridon; int ygridon; // plottype = 0 continuous line // plottype = 10 user defined character // plottype = 20 rectangle // plottype = 21 circle // plottype = 22 triangle // plottype = 23 diamond // plottype = 24 pentagon

va
// // // // // // // // // // // plot 124

//====================================================== // Numerical Analysis package in java // Plot class to plot 2D data // Dr. Turhan Coban // ===================================================== import java.io.*; import java.applet.*; import java.awt.*;

dil
1:42 cizgiciz.java 1:57 Plot.java Plot Label X axis Label Y axis Label file name real max,min scale absolute max,min scale max number of data points max number of data sets x data y=f(x) data n : number of data in each // color code 0-255

i.c o

public void paint(Graphics g) { g.setColor(new Color(100,255,125)); g.setFont(new Font("SansSerif",Font.PLAIN,24)); g.drawString(s,100,25); g.drawChars(c,2,3,100,50); g.drawBytes(b,0,6,100,75); } }

m

125

ww w. ja

public Plot(String pl,String xl,String yl,int xnt,int ynt,int xgo,int ygo,String ifn[],int ipt[],int ir[],int ig[],int ib[]) throws IOException { xmin=9.99e50; xmax=-9.99e50; ymin=9.99e50; ymax=-9.99e50; xntic=8; yntic=8; double xtemp,ytemp; label=pl; xlabel=xl; ylabel=yl; nline=ifn.length; xntic=xnt; yntic=ynt; xgridon=xgo; ygridon=ygo; n=new int[nline]; red=new int[nline]; green=new int[nline]; blue=new int[nline]; plottype=new int[nline]; ch=new char[nline]; //read all data to determine limit values String fn[]; fn=new String[nline]; int i,j; for(i=0;i<nline;i++) { fn[i]=ifn[i]; plottype[i]=ipt[i]; if(plottype[i] == 10) ch[i]='*'; red[i]=ir[i]; green[i]=ig[i]; blue[i]=ib[i]; j=0; n[i]=0; //open ffile lineDataFile=new File(fn[i]); lineDataFile=new File(lineDataFile.getAbsolutePath()); try{ ffile=new DataInputStream(new FileInputStream(lineDataFile));

va
125

dil

i.c o

// plottype = 25 hexagon char ch[]; // plot character (used with plottype 10) int xntic; // number of tics in x axis int yntic; // number of tics in y axis DataInputStream fin; DataInputStream ffile; File plotFile; File lineDataFile; public void set_plotwindow(int width,int height,double xip,double yip,double dxp,double dyp) { //sets rectangular plot window xabsmin = (int)(width*(xip+0.2)); yabsmin = (int)(height*(yip+0.2)); abswidth = (int)(width*dxp); absheight = (int)(height*dyp); }

m

126

ww w. ja

} x=new double[nline][nmax]; y=new double[nline][nmax]; //re-read the data again to load it lineDataFile=new File(fn[i]); lineDataFile=new File(lineDataFile.getAbsolutePath()); for(i=0;i<nline;i++) { //open ffile try{ ffile=new DataInputStream(new FileInputStream(lineDataFile)); } catch(IOException e) { System.err.println("Error Opening File \n"+e.toString()); System.exit(1); } for(j=0;j<n[i];j++) { x[i][j]=Text.readDouble(ffile); y[i][j]=Text.readDouble(ffile); } //close ffile try{ ffile.close(); } catch(IOException e) { System.err.println("Error Closing File\n"+e.toString()); System.exit(1); }

va
126

} catch(IOException e) { System.err.println("Error Opening File \n"+e.toString()); System.exit(1); } try{ while(ffile!=null) { xtemp=Text.readDouble(ffile); ytemp=Text.readDouble(ffile); if(xtemp<xmin) xmin=xtemp; if(xtemp>xmax) xmax=xtemp; if(ytemp<ymin) ymin=ytemp; if(ytemp>ymax) ymax=ytemp; n[i]++; } } catch(EOFException e_eof) { //close ffile try{ ffile.close(); } catch(IOException e) { System.err.println("Error Closing File\n"+e.toString()); System.exit(1); } } //End of EOFException if(i==0) nmax=n[i]; else { if(n[i]>nmax) nmax=n[i]; }

dil

i.c o

m

127

}

// // A sample data file input : //

ww w. ja

// 4 10 10 1 1 // b.dat 22 0 0 0 // a.dat 21 0 255 0 // a.dat 0 0 255 0 // b.dat 0 0 0 255 // // see above for meaning of plot types xmin=9.99e50; xmax=-9.99e50; ymin=9.99e50; ymax=-9.99e50; xntic=8; yntic=8; double xtemp,ytemp; plotFile=new File("Plot.dat"); plotFile=new File(plotFile.getAbsolutePath()); try{ fin=new DataInputStream(new FileInputStream(plotFile)); } catch(IOException e) { System.err.println("Error Opening File \n"+e.toString()); System.exit(1); } label=Text.readStringLine(fin); xlabel=Text.readStringLine(fin); ylabel=Text.readStringLine(fin); nline=Text.readInt(fin); xntic=Text.readInt(fin); yntic=Text.readInt(fin); xgridon=Text.readInt(fin); ygridon=Text.readInt(fin); n=new int[30]; red=new int[30]; green=new int[30]; blue=new int[30]; plottype=new int[30]; ch=new char[30]; //read all data to determine limit values String fn[]; fn=new String[nline];

va
127

dil

i.c o

public Plot() throws IOException { //adding max-min prompts and input fields //initial values of max and mins // Structure of input file // filename // xlabel // ylabel // nline xntic yntic xgridon ygridon // datafilename plottype redcolor greencolor bluecolor // ........ // datafilename plottype redcolor greencolor bluecolor

m

} set_plotwindow(600,500,0.15,0.1,0.8,0.6);

128

ww w. ja
if(i==0) nmax=n[i]; else { if(n[i]>nmax) nmax=n[i]; }

int i,j; for(i=0;i<nline;i++) { fn[i]=Text.readString(fin); plottype[i]=Text.readInt(fin); if(plottype[i] == 10) ch[i]=Text.readChar(fin); red[i]=Text.readInt(fin); green[i]=Text.readInt(fin); blue[i]=Text.readInt(fin); j=0; n[i]=0; //open ffile lineDataFile=new File(fn[i]); lineDataFile=new File(lineDataFile.getAbsolutePath()); try{ ffile=new DataInputStream(new FileInputStream(lineDataFile)); } catch(IOException e) { System.err.println("Error Opening File \n"+e.toString()); System.exit(1); } try{ while(ffile!=null) { xtemp=Text.readDouble(ffile); ytemp=Text.readDouble(ffile); if(xtemp<xmin) xmin=xtemp; if(xtemp>xmax) xmax=xtemp; if(ytemp<ymin) ymin=ytemp; if(ytemp>ymax) ymax=ytemp; n[i]++; } } catch(EOFException e_eof) { //close ffile try{ ffile.close(); } catch(IOException e) { System.err.println("Error Closing File\n"+e.toString()); System.exit(1); } } //End of EOFException

} //close ffile try{ ffile.close(); } catch(IOException e) { System.err.println("Error Closing File\n"+e.toString()); System.exit(1); } x=new double[nline][nmax]; y=new double[nline][nmax]; //re-read the data again to load it

va
128

dil

i.c o

m

129

}

ww w. ja
} PLOTSH~2 JAV 11.584 16/06/98 public class PlotShapes extends Applet { Graphics g; int xabsmin,yabsmin; int absheight,abswidth;

set_plotwindow(400,400,0.1,0.1,0.8,0.6); //close fin try{ fin.close(); } catch(IOException e) { System.err.println("Error Closing File\n"+e.toString()); System.exit(1); } }

//====================================================== // Numerical Analysis package in java // PlotShapes class // This class convert graphic draw methods to // plot coordinates and gives additional plotting methods // Dr. Turhan Coban // ===================================================== import java.io.*; import java.applet.*; import java.awt.*;

va
129

dil

} //close ffile try{ ffile.close(); } catch(IOException e) { System.err.println("Error Closing File\n"+e.toString()); System.exit(1); }

i.c o
1:57 PlotShapes.java

for(i=0;i<nline;i++) { //open ffile try{ lineDataFile=new File(fn[i]); lineDataFile=new File(lineDataFile.getAbsolutePath()); ffile=new DataInputStream(new FileInputStream(lineDataFile)); } catch(IOException e) { System.err.println("Error Opening File \n"+e.toString()); System.exit(1); } for(j=0;j<n[i];j++) { x[i][j]=Text.readDouble(ffile); y[i][j]=Text.readDouble(ffile);

m

130

double xmin,xmax,ymin,ymax; public PlotShapes(Graphics gi,int xabsmini ,int yabsmini, int absheighti,int abswidthi, double xmini,double xmaxi, double ymini,double ymaxi) { // xabsmin : absulute stating point x axis // yabsmin : absolute starting point y axis // absheight : absoulute height of plotting window // abswidth : absolute width of plotting window // xmin : minimum x value (real number) // xmax : maximum x value (real number) // ymin : minimum y value (real number) // ymax : maximum y value (real number) // g : graphic object that actual drawing is done through g=gi; xabsmin=xabsmini; yabsmin=yabsmini; absheight=absheighti; abswidth=abswidthi; xmin=xmini; xmax=xmaxi; ymin=ymini; ymax=ymaxi; }

ww w. ja
} //end of PlotShapes.drawChar

public void drawLine(int plottype,double x1,double y1,double x2,double y2) { // draw a line from (x1,y1) to (x2,y2) if(plottype==0) //draw a continuous line { g.drawLine( (int)(xabsmin+(x1-xmin)/(xmax-xmin)*abswidth), (int)(yabsmin+absheight-(y1-ymin)/(ymaxymin)*absheight), (int)(xabsmin+(x2-xmin)/(xmax-xmin)*abswidth), (int)(yabsmin+absheight-(y2-ymin)/(ymaxymin)*absheight)); } } //end of drawLine public void drawChar(char ch,double x1,double y1) { // draws a single character at (x1,y1) char ch1[]=new char[1]; ch1[0]=ch; int h=g.getFontMetrics().getHeight(); int w=h-2; g.drawChars(ch1,0,1, (int)(xabsmin+(x1-xmin)/(xmax-xmin)*abswidth)-2, (int)(yabsmin+absheight-(y1-ymin)/(ymax-ymin)*absheight)+h/2);

public void drawChars(char ch[],int firstspace,int numberofchars, double x1,double y1) { // draws a character array from space firstspace to (firstspace+numberofchars) // starting at (x1,y1)

va
130

dil

i.c o

m

131

}

//end of PlotShapes.drawChars

public void drawString(String s,double x1,double y1) { //draws a String at (x1,y1) int h=g.getFontMetrics().getHeight(); int w=h-2; g.drawString(s, (int)(xabsmin+(x1-xmin)/(xmax-xmin)*abswidth), (int)(yabsmin+absheight-(y1-ymin)/(ymax-ymin)*absheight)); } //end of PlotShapes.drawStrings

}//end of drawRect

ww w. ja

public void drawOval(double x1,double y1,int width,int height) { // draw an oval with the centre of (x1,y1) // with dimension of (width,height) g.drawOval( (int)(xabsmin+(x1-xmin)/(xmax-xmin)*abswidth-width/2), (int)(yabsmin+absheight-(y1-ymin)/(ymax-ymin)*absheightheight/2), width,height); }//end of drawRect public void drawPolygon(double x1,double y1,int radius,int side) { //draw a polygon of n sides n=3(trinagle),n=4(dimond).... double Pi=4.0*Math.atan(1.0); int xvalues[]=new int[side+1]; int yvalues[]=new int[side+1]; double angle_increase; double angle; angle_increase=2.0*Pi/side; angle=Pi/2.0; for(int i=0;i<side;i++) { xvalues[i]= (int)(Math.floor(xabsmin+(x1-xmin)/ (xmax-xmin)*abswidth+radius*Math.cos(angle))); yvalues[i]= (int)(Math.floor(yabsmin+absheight-(y1-ymin)/ (ymax-ymin)*absheight-radius*Math.sin(angle))); if(i==0) {xvalues[side]=xvalues[i];yvalues[side]=yvalues[i];} angle+=angle_increase;

va
131

dil

public void drawRect(double x1,double y1,int rectwidth,int rectheight) { // draw a rectangle starting at (x1,y1) // with dimensions of (rectwidth,rectheight) g.drawRect( (int)(xabsmin+(x1-xmin)/(xmax-xmin)*abswidth-rectwidth/2), (int)(yabsmin+absheight-(y1-ymin)/(ymax-ymin)*absheightrectheight/2), rectwidth,rectheight);

i.c o

m

int h=g.getFontMetrics().getHeight(); int w=h-2; g.drawChars(ch,firstspace,numberofchars, (int)((xabsmin+(x1-xmin)/(xmax-xmin)*abswidth)+5), (int)((yabsmin+absheight-(y1-ymin)/(ymaxymin)*absheight)+h/2));

132

ww w. ja
}

public void drawYTic(int ticNumber,double ticWidth,int ticSide) { //draw a series of y axis tics double dtic=(ymax-ymin)/ticNumber; double x1=xmin; double y1=ymin; if(ticSide==0) { for(int i=0;i<=ticNumber;i++) { drawLine(0,x1,y1,(x1-ticWidth),y1); y1=y1+dtic; } } else { for(int i=0;i<=ticNumber;i++) { drawLine(0,x1,y1,(x1+ticWidth),y1); y1=y1+dtic; } }

public void drawXGrid(int ticNumber) { //draw x gridlies ||||||| double dtic=(xmax-xmin)/ticNumber; double x1=xmin; for(int i=0;i<=ticNumber;i++) {

va
132

dil

public void drawXTic(int ticNumber,double ticHeight,int ticSide) { //draw a series of x axis tics double dtic=(xmax-xmin)/ticNumber; double x1=xmin; double y1=ymin; if(ticSide==0) { for(int i=0;i<=ticNumber;i++) { drawLine(0,x1,y1,x1,(y1-ticHeight)); x1=x1+dtic; } } else { for(int i=0;i<=ticNumber;i++) { drawLine(0,x1,y1,x1,(y1+ticHeight)); x1=x1+dtic; } } }

i.c o

m

} g.drawPolygon(xvalues,yvalues,side+1); }//end of drawPolygon

133

} } public void drawYGrid(int ticNumber) { //draw y gridlines ===== double dtic=(ymax-ymin)/ticNumber; double y1=ymin; for(int i=0;i<=ticNumber;i++) { drawLine(0,xmin,y1,xmax,y1); y1=y1+dtic; } }

ww w. ja

public void drawYNumbers(int ticNumber) { // draw y numbers double dtic=(ymax-ymin)/ticNumber; double x1=xmin; double y1=ymin; String s; s=" "; for(int i=0;i<=ticNumber;i++) { s=Double.toString(Math.floor(y1*100)/100.0)+" "; g.drawString(s,(int)(xabsmin+(x1-xmin)/(xmax-xmin)*abswidth-40), (int)(yabsmin+absheight-(y1-ymin)/(ymax-ymin)*absheight)); y1=y1+dtic; } } public void drawXLabel(String xLabel) { // draw x labels double x1=xmin+(xmax-xmin)/2.0; double y1=ymin; g.drawString(xLabel,(int)(xabsmin+(x1-xmin)/(xmax-xmin)*abswidth), (int)(yabsmin+absheight-(y1-ymin)/(ymax-ymin)*absheight)+30); }

va
133

public void drawXNumbers(int ticNumber) { //draw x numbers double dtic=(xmax-xmin)/ticNumber; double x1=xmin; double y1=ymin; String s; s=" "; for(int i=0;i<=ticNumber;i++) { s=Double.toString(Math.floor(x1*100.0)/100.00); g.drawString(s,(int)(xabsmin+(x1-xmin)/(xmax-xmin)*abswidth), (int)(yabsmin+absheight-(y1-ymin)/(ymax-ymin)*absheight)+20); x1=x1+dtic; } }

dil

i.c o

m

drawLine(0,x1,ymin,x1,ymax); x1=x1+dtic;

134

ww w. ja

public void drawPlotLines(int i,int plottype[],double x[][],double y[][],int n[],char ch[]) { int j; //draw lines if(plottype[i]==0) { for(j=0;j<n[i]-1;j++) { if((x[i][j]>=xmin && x[i][j]<=xmax ) && (y[i][j]>=ymin && y[i][j]<=ymax)) { if((x[i][j+1]>=xmin && x[i][j+1]<=xmax) && (y[i][j+1]>=ymin && y[i][j+1]<=ymax)) { drawLine(0,x[i][j],y[i][j],x[i][j+1],y[i][j+1]); } else if(x[i][j+1]>xmax) { double b=(y[i][j+1]-y[i][j])/(x[i][j+1]-x[i][j]); double a=y[i][j]-b*x[i][j]; drawLine(0,x[i][j],y[i][j],xmax,(a+b*xmax)); } else if(y[i][j+1]>ymax) { double b=(y[i][j+1]-y[i][j])/(x[i][j+1]-x[i][j]); double a=y[i][j]-b*x[i][j]; drawLine(0,x[i][j],y[i][j],(ymax-a)/b,ymax); } else if(x[i][j+1]>xmax && y[i][j+1]>ymax) { double b=(y[i][j+1]-y[i][j])/(x[i][j+1]-x[i][j]); double a=y[i][j]-b*x[i][j];

va
134

dil

public void drawLabel(String Label) { //draw graphic label double x1=xmin+(xmax-xmin)/2.0; double y1=ymax; g.drawString(Label,(int)(xabsmin+(x1-xmin)/(xmax-xmin)*abswidth), (int)(yabsmin+absheight-(y1-ymin)/(ymax-ymin)*absheight)-10); }

i.c o

public void drawYLabel(String yLabel) { // draw y labels double x1=xmin-(xmax-xmin)/6.0; double y1=ymax-(ymax-ymin)/3.0; int n=yLabel.length(); char ch[]=new char[n]; yLabel.getChars(0,n,ch,0); // g.DrawString(yLabel,(int)(xabsmin+(x1-xmin)/(xmax-xmin)*abswidth-60), // (int)(yabsmin+absheight-(y1-ymin)/(ymax-ymin)*absheight)); for(int i=0;i<n;i++) { drawChar(ch[i],x1,y1); y1=y1-(ymax-ymin)/30; } }

m

135

ww w. ja

} else if((x[i][j+1]>=xmin && x[i][j+1]<=xmax ) && (y[i][j+1]>=ymin && y[i][j+1]<=ymax)) { if(x[i][j]<xmin) { double b=(y[i][j+1]-y[i][j])/(x[i][j+1]-x[i][j]); double a=y[i][j+1]-b*x[i][j+1]; drawLine(0,xmin,(a+b*xmin),x[i][j+1],y[i][j+1]); } if(y[i][j]<ymin) { double b=(y[i][j+1]-y[i][j])/(x[i][j+1]-x[i][j]); double a=y[i][j+1]-b*x[i][j+1]; drawLine(0,(ymin-a)/b,ymin,x[i][j+1],y[i][j+1]); } } }//end of for(j=0 }//end of if(plottype //draw characters else if(plottype[i]==10) { for(j=0;j<n[i];j++) { if((x[i][j]>=xmin && x[i][j]<=xmax ) && (y[i][j]>=ymin && y[i][j]<=ymax)) { drawChar(ch[i],x[i][j],y[i][j]); } }//end of for(j=0; }//end else if(plottype[i]==10) //draw rectangles else if(plottype[i]==20) { for(j=0;j<n[i];j++) { if((x[i][j]>=xmin && x[i][j]<=xmax ) && (y[i][j]>=ymin && y[i][j]<=ymax)) { drawRect(x[i][j],y[i][j],4,4); } }//end of for(j=0; }//end else if(plottype[i]==20) //draw circle else if(plottype[i]==21) { for(j=0;j<n[i];j++) { if((x[i][j]>=xmin && x[i][j]<=xmax ) && (y[i][j]>=ymin && y[i][j]<=ymax)) { drawOval(x[i][j],y[i][j],4,4); } }//end of for(j=0; }//end else if(plottype[i]==21) else if(plottype[i]>=22 && plottype[i]<=27) { for(j=0;j<n[i];j++) { if((x[i][j]>=xmin && x[i][j]<=xmax ) && (y[i][j]>=ymin && y[i][j]<=ymax)) {drawPolygon(x[i][j],y[i][j],5,(plottype[i]-19));} }//end of for(j=0; }//end else if(plottype[i]==21..27) }

va
135

dil

i.c o

m

}

drawLine(0,x[i][j],y[i][j],(ymax-a)/b,(a+b*xmax));

136

} PLOTAP~2 JAV 4.119 16/05/98 22:21 PlotApplet.java

ww w. ja
//label //xaxis //yaxis // 4 10 10 1 1 // b.dat 22 0 0 0 // a.dat 21 0 255 0 // a.dat 0 0 255 0 // b.dat 0 0 0 255 int xnt=10; int ynt=10; int xgo=1; int ygo=1; String il=new String("label"); String xl=new String("x axis"); String yl=new String("y axis"); String ifn[]=new String[4]; ifn[0]="b.dat"; ifn[1]="a.dat"; ifn[2]="a.dat"; ifn[3]="b.dat"; int ipt[]=new int[4];

public void initplot() throws IOException { //adding max-min prompts and input fields

va
136

public void init() { try{initplot();} catch(IOException e_eof) {showStatus("IO exception");} catch(SecurityException e_s) {showStatus("Security exception");} }

dil

public class PlotApplet extends Applet { Label promptXmin; // Label prompt in Label promptXmax; // Label prompt in Label promptYmin; // Label prompt in Label promptYmax; // Label prompt in TextField inputXmin; // input field TextField inputXmax; // input field TextField inputYmin; // input field TextField inputYmax; // input field Plot p1;

i.c o
implements ActionListener Xmin Xmax Ymin Ymax Xmin Xmax Ymin Ymax field field field field

//====================================================== // Numerical Analysis package in java // PlotApplet class to plot 2D data // Dr. Turhan Coban // ===================================================== import java.io.*; import java.applet.*; import java.awt.*; import java.awt.event.*; import PlotShapes; import Plot;

m

137

ww w. ja

try{ //p1=new Plot(il,xl,yl,xnt,ynt,xgo,ygo,ifn,ipt,ir,ig,ib); p1=new Plot(); } catch(SecurityException ase) {System.out.println("applet security exception");} promptXmin=new Label("Xmin "); inputXmin=new TextField(5); promptXmax=new Label("Xmax "); inputXmax=new TextField(5); promptYmin=new Label("Ymin "); inputYmin=new TextField(5); promptYmax=new Label("Ymax "); inputYmax=new TextField(5); inputXmin.addActionListener(this); inputXmax.addActionListener(this); inputYmin.addActionListener(this); inputYmax.addActionListener(this); add(promptXmin); add(inputXmin); add(promptXmax); add(inputXmax); add(promptYmin); add(inputYmin); add(promptYmax); add(inputYmax); } public void paint(Graphics g) { inputXmin.setText(Double.toString(p1.xmin)); inputXmax.setText(Double.toString(p1.xmax)); inputYmin.setText(Double.toString(p1.ymin)); inputYmax.setText(Double.toString(p1.ymax)); PlotShapes ps=new PlotShapes(g,p1.xabsmin,p1.yabsmin, p1.absheight,p1.abswidth,p1.xmin,p1.xmax,p1.ymin,p1.ymax); g.drawRect(p1.xabsmin,p1.yabsmin,p1.abswidth,p1.absheight); ps.drawXTic(p1.xntic,(p1.ymax-p1.ymin)/80.0,0); ps.drawYTic(p1.yntic,(p1.xmax-p1.xmin)/80.0,0); ps.drawXNumbers(p1.xntic); ps.drawYNumbers(p1.xntic); ps.drawLabel(p1.label);

va
137

dil

i.c o

int ib[]=new int[4]; int ir[]=new int[4]; int ig[]=new int[4]; ipt[0]=22; ipt[1]=21; ipt[2]=0; ipt[3]=0; ir[0]=0; ig[0]=0; ib[0]=0; ir[1]=0; ig[1]=255; ib[1]=0; ir[2]=0; ig[2]=255; ib[2]=0; ir[3]=0; ig[3]=255; ib[3]=0;

m

138

//

}

ww w. ja
Bilgi dosyası Plot.dat

label of the plot xaxis of the plot

va
Plot başlığı x axis başlığı 138

dil

public void actionPerformed( ActionEvent e) { Double valXmin=new Double(inputXmin.getText()); p1.xmin=valXmin.doubleValue(); Double valXmax=new Double(inputXmax.getText()); p1.xmax=valXmax.doubleValue(); Double valYmin=new Double(inputYmin.getText()); p1.ymin=valYmin.doubleValue(); Double valYmax=new Double(inputYmax.getText()); p1.ymax=valYmax.doubleValue(); repaint(); }

i.c o

ps.drawXLabel(p1.xlabel); ps.drawYLabel(p1.ylabel); if(p1.xgridon!=0) ps.drawXGrid(p1.xntic); if(p1.ygridon!=0) ps.drawYGrid(p1.yntic); int i,j; for(i=0;i<p1.nline;i++) { Select plot colors g.setColor(new Color(p1.red[i],p1.green[i],p1.blue[i])); ps.drawPlotLines(i,p1.plottype,p1.x,p1.y,p1.n,p1.ch); }//end of for(i=0 }//end of method

m

139

Bilgi dosyası a.dat

Bilgi dosyası b.dat

ww w. ja
Bilgi dosyası c.dat

1 2 3 4 5

1 2 3 4 5

Bu haftaki alıştırmalar:

ALIŞTIRMA 1

drawRect ve fillRect metodlarını kullanarak biri dolu diğeri sadece bir çizgi olan iki dikdörtgen çiz.

ALIŞTIRMA 2 drawOval ve fillOval metodlarını kullanarak biri dolu diğeri sadece bir çizgi olan iki daire çiz. ALIŞTIRMA 3 ciz metodundaki ikinci resmi iptal ederek sadece bir resim kalmasını sağla

import java.applet.Applet;

va
139

0 0 0.526316 0.277008 1.05263 1.10803 1.57895 2.49307 2.10526 4.43213 2.63158 6.92521 3.15789 9.9723 3.68421 13.5734 4.21053 17.7285 4.73684 22.4377 5.26316 27.7008 5.78947 33.518 6.31579 39.8892 6.84211 46.8144 7.36842 54.2936 7.89474 62.3269 8.42105 70.9141 8.94737 80.0554 9.47368 89.7507 10 100

dil

i.c o

1 2 3 4 5 6 7

1 4 9 16 25 36 49

m

yaxis of the plot 3 10 10 0 0 a.dat 10 * 0 0 255 b.dat 0 255 0 0 c.dat 0 255 100 0

y axis başlığı plot cizgi sayısı logaritmikX logaritmikY gridX gridY dosyaİsmi plot_türü (10 ise plot char) Kırmızı Yesil Ma dosyaİsmi Plot_türü Kırmızı Yesil Mavi dosya_ismi Plot_türü Kırmızı Yeşil Mavi

140

import java.awt.*; public class resim extends Applet { private Image bebek; public void init() { bebek=getImage(getDocumentBase(),"turhan.gif"); } public void paint(Graphics g) { g.drawImage(bebek,1,1,this); } }

ALIŞTIRMA 4 drawPolygon ve fillPolygon metodlarını kullanarak biri dolu diğeri sadece bir çizgi olan iki eşkenar üçgen çiz.

import java.applet.Applet; import java.awt.*;

ww w. ja
ALIŞTIRMA 5

public class ucgenCiz extends Applet { public void paint(Graphics g) { int x[]={10,(int)(10+100*Math.cos(Math.PI/3.0)),110,10}; int y[]={100,(int)(100-100*Math.sin(Math.PI/3.0)),100,100}; int x1[]={130,(int)(130+100*Math.cos(Math.PI/3.0)),230,130}; int y1[]; y1=y; g.setColor(new Color(0,255,0)); g.drawPolygon(x,y,4); g.fillPolygon(x1,y1,4); } }

PlotShapes,Plot, PlotApplet sınıflarını incele, ve calistır. Not dosyaları incelediğinizde daha gelecek bölümlerde göreceğimiz yanliş kontrolü ve dosyaya

va
140

dil

i.c o

m

141
yazdırıp okutma metodlarını da göreceksiniz. Bu detaylar icin ilgili bolümleri okuyabilirsiniz veya programların bu bölümleri için daha sonraki bölümleri işlemeyi bekleyebilirsiniz. ALIŞTIRMA 6 Türkçe renkleri tanımlıyan renk sınıfını yaz.

ww w. ja
141

va

dil

i.c o

m

142

7.1 Graphic Kullanıcısı Arabirim programları, GUI, (Graphics User Interface)

ww w. ja
Sınıflarını incelemeye calışacağız.

• •

7.2 Label (Etiket) sınıfı

Label sınıfı Appletin içine sadece okunabşlen fakat değiştirilemeyen yazılar yazma amacıyla kullanılırlar. Label sınıfında tanımlanan metotlar şunlardır: 1. Kurucu Metotlar : public Label() // Label sınıfı nesneyi olusturur herhangi bir yazı göstermez public Label(String s) // Label sınıfı nesneyi olusturur ve s stringini gösterir public void Label(String s,int pozisyon) // Label sınıfı nesneyi olusturur ve s stringi gösterir aynı zamanda Labeli pozisyonda verilen değere göre istenilen yere yerleştirir. Yerleştirme konumları :Label.LEFT,Label.CENTER,Label.RIGHT (sol,orta,sağ) konumlarıdır. 2. Giriş çıkış metotları public String getText() // Label sınıfının String değişkenini okur.
142

va

1. • • 2. 3. 4. 5. 6. 7. 8. 9. •

TextComponent TextField TextArea Button Label Checkbox List Choice Canvas Scrollbar Container Panel Java.applet.Applet ScrollPane Window Frame Dialog

dil

i.c o

Grafik kullanıcı arabirim programları, GUI, programınıza kullanıcının daha iyi anlıyabileceği bir görünüş verme amacıyla oluşturulur. Kullanıcıya sunulan programın onun rahatlıkla anlayabileceği bir formata sahip olması günümüz programlamacılığında oldukça önemlidir. Reklamlarla büyüyen bir kuşak için paket bazen paketin içindekinden bile onemli hale gelebilmektedir. Grafik Kullanıcısı Arabirim programları kullanıcıya sunduğumuz be paketi oluşturmaktadır. GUI metodları java.awt (Abstract windowing toolkit) paketinde yer almaktadır. Bu pakette Container ve Component isimli iki alt pakette yer almaktadır. Her zaman kullndığımız Applet sınıfı Component sınıfından türiyen Panel sınıfının alt sınıfıdır. Yani Component Appletlerin süper sınıfıdır. Burada Component sınıfının

m

BÖLÜM 7: Grafik Applet Oluşturma Metotları, Grafik Kullanıcısı Arabirim programları (GUI)

143

import java.applet.Applet; import java.awt.*;

}

ww w. ja
7.3 Button (Düğme) sınıfı

Şekil 7.2.1 LabelTesti.java rogramı ve appleti

LabelTesti programında kullanılan add metodu Lable’i Container sınıfına(Appletin alt sınıfı olduğu) bağlar, diğer deyimle applete ilave eder.

Button (düğme) basılınca belirli işlemlerin yapılmasını başlatan bir sınıftır. Graphic arabirim kullanım (GUI) programlarını veya Applet programlarını konsol programlarından ayıran en önemli özellik, GUI lerin işlem kökenli olmasıdır. Diğer bir deyimle kullanıcının başlatacağı işlemleri yapar ve kullanıcının yeni bir işlem tanımlamasını beklerler. Bu işlemleri yapan

va
143

public void paint(Graphics g) { g.drawString("L1 : "+L1.getText(),25,80); g.drawString("L2 : "+L2.getText(),25,95); }

dil

public class LabelTesti extends Applet { private Label L1,L2; public void init() { L1=new Label(); L1.setText("Bu etiket once bos tanimlandi"); add(L1); L2=new Label("Bu etiket yazisi ilk tanimda tanimlandi"); add(L2); }

i.c o

public void setText(String s) // Label sınıfının String değişkenine yeni değer girer. public void setAlignment(int pozisyon) Labeli pozisyonda verilen değere göre istenilen yere yerleştirir. Yerleştirme konumları :Label.LEFT,Label.CENTER,Label.RIGHT (sol,orta,sağ) konumlarıdır. Örnek olarak bir bir program verelim :

m

144

ww w. ja
import java.applet.Applet; import java.awt.*; import java.awt.event.*;

sınıflar java.awt.event kütüphanesinde tanımlanmıştır. Bu kütüphanede en çok kullanacağımız sınıflar hiyerarşi düzeninde şöyle verilebilir : Java.util.EventObject • Java.awt.AWTEvent 1. ActionEvent // Bir dügme(Button) basıldığında,Listeden (List) iki klikle bir seçim yapıldığında veya menuden seçim yapıldığında kullanılır. 2. AdjustmentEvent // asağı yukarı kaydırma cubugunda (scroll bar) bir işlem yapıldığında kullanılır. 3. ItemEvent // List veya CheckBox kliklendiginde (bir kere) kullanılır 4. ComponentEvent //appletteki elemanların gizlenmesi, boylarının değiştirilmesi, veya değişik yerlere alınması amacıyla kullanılır. 4.1 ContainerEvent //Containera(applete) yeni bir eleman eklenilir veya çıkarılırken kullanılır. 4.2 FocusEvent//herhangi bir applet elemanı kullanılmaya baslandıgında on plana cıkarılmakk, ve kullanılmadıgında arka plana atılmak istendiğinde kullanılır. 4.3 PaintEvent 4.4 WindowEvent//pencere acılıp kapandığında,kücültülüp büyütüldüğünde vb. 4.5 InputEvent 4.5.1 KeyEvent//keyboarddan bir girdi alındığında kullanılır 4.5.2 MouseEvent//mouse dan bir girdi alındığında kullanılır Kullanıcı bir applet programı yazarken dinleme ile ilgili iki işlem yapar ilk işlem herhangi bir GUI dan bir girdi olup olmadığını dinlemek olduysa kaydetmek ikincisi ise bu işlemin sebep olacağı işlemleri oluşturmaktır. Dinleme işlemini yapan metodlar şunlardır : Java.util.EventListener 1. ActionListener 2. AdjustmentListener 3. ComponentListener 4. ContainerListener 5. FocusListener 6. ItemListener 7. KeyListener 8. MouseListener 9. MouseMotionListener 10. TextListener 11. WindowListener Bu metotların birçoğunu ilgili orneklerde yeri geldiğinde kullanacağız. Şimdi aynı sonucu veren iki button orneği ile bu kavramı biraz daha açmaya çalışalım :

public class ButtonTesti extends Applet { private Button B1,B2; public void init() { B1=new Button("B1"); B1.addActionListener(new B1Basilinca(this)); add(B1); 144

va

dil

i.c o

m

145

public B1Basilinca(Applet a) {applet=a;}

public void actionPerformed(ActionEvent e) { applet.showStatus(" "+e.getActionCommand()+"dugmesine basildi"); } }

public B2Basilinca(Applet a) {applet=a;}

public void actionPerformed(ActionEvent e) { applet.showStatus(" "+e.paramString()+"dugmesine basildi"); } }

ww w. ja
import java.applet.Applet; import java.awt.*; import java.awt.event.*; public void init() { B1=new Button("B1"); B1.addActionListener(this); add(B1); B2=new Button("B2"); B2.addActionListener(this); add(B2); }

Şekil 7.3.1 ButtonTesti.java sınıfı ve sonuçlarının appletde görünmesi

public class ButtonTesti1 extends Applet implements ActionListener { private Button B1,B2;

va
145

dil

class B2Basilinca implements ActionListener { Applet applet;

i.c o

class B1Basilinca implements ActionListener { Applet applet;

m

B2=new Button("B2"); B2.addActionListener(new B2Basilinca(this)); add(B2); } }

146

Şekil 7.3.2 ButtonTesti1.java sınıfı (sonuclar ButtonTesti1.java ile aynıdır)

Birinci programda düğmelere basıldığında oluşan eylemler (showStatus köşesine basılan düğmeyi yazdırma) ayrı sınıflarda yaptırılmış ve Applet sınıfı üzerinden bizim ButtonTesti sınıfına aktarılmıştır. İkinci programda ise aynı işlemler tek bir sınıfın içerisinde yer almıştır. Programdan da görülecegi gibi düğme basma eylemi ActionEvent sınıfı üzerinden aktarılmıştır. 7.4 TextField(YazımAlanı) sınıfı

TextField bir satırlık yazım alanlarıdır. TextField’in metotları aşağıda verilmiştir : 1. Kurucu Metodlar : public TextField() public TextField(int satırsayısı) // satır sayısı uzunluğunda bir yazı kutusu açar. public TextField(String s) // s uzunluğunda bir yazı kutusu açr ve s yi içine yazar public TextField(String s,int satırsayısı) ) // satır sayısı uzunluğunda bir yazı kutusu açr ve s yi içine yazar 2. Diğer Metotlar: Public void setEchoChar(char c) // kutudaki gerçek yazıyı gizleyerek onun yerine c karacter değişkenini yazar. Public void setEditable(boolean b) //kutunun içine yazılan yazının degiştirileblmesini sağlar veya engeller b=true yazı yazılabilir b=false yazı yazılamaz. Bu metotların kullanımını yine bir program örneğiyle izleyelim :

ww w. ja
import java.applet.Applet; import java.awt.*; import java.awt.event.*;

public class TextFieldTesti extends Applet implements ActionListener { private TextField T1,T2,T3,T4; public void init() { setBackground(Color.lightGray); //bos textField T1=new TextField(); T1.addActionListener(this); add(T1); T2=new TextField("Buraya yazi yaziniz"); T2.addActionListener(this); add(T2);

va
146

dil

i.c o

}

m

public void actionPerformed(ActionEvent e) { if(e.getSource()==B1) {showStatus(" "+e.getActionCommand()+"dugmesine basildi");} else if(e.getSource()==B2) {showStatus(" "+e.paramString()+"dugmesine basildi");} }

147

public void actionPerformed(ActionEvent e) { showStatus("Yazi : "+e.getActionCommand()); } }

ww w. ja
7.5 TextArea(YazımAlanı) sınıfı

Şekil 7.4.1 TextFieldTesti.java programı ve sonuçlarının appletde görünümü

Bu programda her yazı alanına (TextField) addActionListener metodu eklenmiş ve bir yazı girildiğinde actionPerformed metodundaki showStatus metodu yoluyla en son girilen yazı showStatus penceresine aktarılmıştır.

Text Area sınıfı yapı olarak TextField sınıfına benzer. En onemli farkı bir satır yerine birden fazla satır girdi alabilme olasılığıdır. TextField ve TextArea sınıfları TextComponent sınıfının alt sınıflarıdır. Bu yüzden üstte belirttiğimiz Public void setEchoChar(char c) // kutudaki gerçek yazıyı gizleyerek onun yerine c karacter değişkenini yazar. Public void setEditable(boolean b) //kutunun içine yazılan yazının degiştirileblmesini sağlar veya engeller b=true yazı yazılabilir b=false yazı yazılamaz.

va
147

dil

i.c o

m

T2=new TextField("gizli yazi"); T2.setEchoChar('*'); T2.addActionListener(this); add(T2); T3=new TextField("gizli yazi"); T3.setEditable(false); add(T3); }

148

ww w. ja
import java.applet.Applet;

import java.applet.Applet; import java.awt.*; public class TextAreaTesti extends Applet { private TextArea T1; public void init() { setBackground(Color.lightGray); //bos textField String s="buraya denemek icin\nyazi yazildi\n\t sonrada bu yazi aktarildi"; //not \n satirbasi kontrolu // \t bir sonraki tab setine git T1=new TextArea(s,5,40); add(T1); } }

Şekil 7.5.1 TextAreaTesti.java Programı Bu programda gördüğünüz \n ve \t string komutlarıdır. Alt satıra geç ve gelecek tab noktasına git anlamına gelir Bu komutlar aslında c dilinden alınmadır ve c dilindeki tüm \ komutları java stringlerinde de geçerlidir. Şimdi TextArea metodunu biraz daha kompleks bir programda kullanalım

va
148

dil

Metotları burada da aynen geçerlidir.TextArea’nınkurucu metotlarıda şöyledir: public TextArea() public TextArea(int sütun,int satır) sütun x satır boyutunda yazı alanı tanımlar public TextArea(String s) String değişkeni s nin boyuna göre yazı alanı tanımlar ve s yi içine yazar. public TextArea(String s,int sütun,int satır) sütun x satır boyutunda yazı alanı tanımlar ve s yi içine yazar public TextArea(String s,int sütun,int satır,int scrollbar) scroll bar (kontrolçubuğu) değişkeni şu değerleri alabilir : SCROLLBARS_BOTH Hem yatay hemdüşey kontrol çubuğu tanımlar SCROLLBARS_HORİZONTAL_ONLY Yatay kontrol çubuğu tanımlar SCROLBARS_NONE Kontrol çubuğu tanımlamaz SCROLLBARS_VERTİCAL_ONLY Düşey kontrol çubuğu tanımlar Şimdi TextArea metodunu Küçük bir örnekte kullanalım :

i.c o

m

149

ww w. ja

Şekil 7.5.3-7.5.4 TextAreaTesti1.java Programı ve sonuçlarını gösteren appletler

va
149

import java.awt.*; import java.awt.event.*; public class TextAreaTesti1 extends Applet implements ActionListener,TextListener { private TextArea T1,T2; private Button kopye; public void init() { setBackground(Color.lightGray); //bos textField String s="buraya denemek icin\nyazi yazildi\n\t sonrada bu yazi aktarildi"; //not \n sat rbaŸ kontrol // \t bir sonraki tab setine git T1=new TextArea(s,5,20,TextArea.SCROLLBARS_NONE); T1.addTextListener(this); add(T1); kopye=new Button("Kopye >>>"); kopye.addActionListener(this); add(kopye); T2=new TextArea(5,20); T2.setEditable(false); add(T2); } public void actionPerformed(ActionEvent e) { // T1 penceresinden seçilen yazıyı // kopye düğmesine basıldığında T2 penceresine aktar T2.setText(T1.getSelectedText()); } public void textValueChanged(TextEvent e) { //Birinci pencereye yeni yazı yazıldığında ikinci pencereye aktar TextComponent kaynak=(TextComponent)(e.getSource()); T2.setText(kaynak.getText()); } }

dil

i.c o

m

150

7.6 Choice (Seçim) sınıfı

Choice (Seçim) sınıfını bir programda kullanalım :
import java.awt.*; import java.applet.Applet; import java.awt.event.*;

ww w. ja

public class ChoiceTesti extends Applet { private Choice F; private TextField T; public void init() { F=new Choice(); F.add("MonoSpaced"); // Courier F.add("SansSerif"); // Helvetica F.add("Serif"); // Times T=new TextField(F.getItem(0),30); T.setEditable(false); T.setFont(new Font(F.getItem(0),Font.PLAIN,12)); F.addItemListener(new FontIsmiKontrolu(T)); F.addItemListener(new TextFieldKontrolu(T)); add(F); add(T); } } class FontIsmiKontrolu implements ItemListener { private Component C; public FontIsmiKontrolu(Component C) { this.C=C; } public void itemStateChanged(ItemEvent e)

va
150

dil

Choice (Seçim) sınıfı birden fazla maddeden seçim yapılması gerektiğinde kullanılan bir sınıftır. Choice sınıfının kurucu metodu ve diger metotlarının listesi aşağıda verilmiştir : public Choice() // Kurucu metot public String getItem(int indeks) İndeksteki seçimi verir public synchronised void add(String s) verilen Stringi Chice listesine ekler. public synchronised String getSelectedItem() Fareyle seçilmiş olan liste elemanını verir public synchronised String insert(String s, int indeks) verilen stringi listeye indeks sırasındaki madde olarak ekle public synchronised void remove(String s) verilen stringi listeden siler

i.c o

m

Bu programda TextListener kullanıldığından textValueChange metodu da kullanılmıştır. Buradaki metot birinci kutuya yazılan yazıyı ikinci kutuya kopyalamaktadır. Kopye düğmesine basılınca ise sadece T1.getSelectedText() metoduyla secilmiş olan text actionPerforned metodu üzerinden T2 Yazım Alanına (TextArea) aktarılmaktadır.

151

}

public void itemStateChanged(ItemEvent e) { Choice C=(Choice)e.getItemSelectable(); T.setText("Indeks : "+ C.getSelectedIndex()+"; Font : "+e.getItem()); }

Sekil 7.6.1 ChoiceTesti.java programı

Choice seçimlerini yukarıdaki ChoiceTesti.html de de görüleceği gibi aktarılırken ItemListener ve ItemEvent kullanılmıştır. Bu metodla kullanılması gereken method ItemStateChanged metodudur.

ww w. ja
7.7 CheckBox ve CheckBoxGroup sınıfları

Sekil 7.6.2 ChoiceTesti.java programının sonuçlarının appletde görülmesi

Check box ve CheckBoxGroup sınıfları çesitli opsiyonlar arasından seçim yapabilme olasılığını sağlayan sınıflardır. Kurucu metotları : Public CheckBox(String s)
151

va

dil

}

i.c o

class TextFieldKontrolu implements ItemListener { private TextField T; public TextFieldKontrolu(TextField T) { this.T=T; }

m

{ C.setFont(new Font(e.getItem().toString(), C.getFont().getStyle(), C.getFont().getSize())); }

152

CheckBox kullanımını anlamak amacıyla CheckBoxTesti.java programına göz atalım :
import java.applet.Applet; import java.awt.*; import java.awt.event.*;

public class CheckBoxTesti extends Applet implements ItemListener { private TextField T; private Checkbox Kalin,Italic; public void init() { setBackground(Color.lightGray); //bos textField T=new TextField("Buradaki yazinin degismesini izleyiniz"); add(T); Kalin=new Checkbox("Kalin"); Kalin.addItemListener(this); add(Kalin); Italic=new Checkbox("Italik"); Italic.addItemListener(this); add(Italic); } public void itemStateChanged(ItemEvent e) { int KalinAyari; if(Kalin.getState()) {KalinAyari=Font.BOLD;} else {KalinAyari=Font.PLAIN;} int ItalicAyari;

ww w. ja
}

if(Italic.getState()) {ItalicAyari=Font.ITALIC;} else {ItalicAyari=Font.PLAIN;} T.setFont(new Font("Serif",KalinAyari+ItalicAyari,14)); }

Şekil 7.7.1 CheckBoxTesti.java programı

va
152

dil

i.c o

m

Tek bir kare kontrol kutusu oluşturur. Kontrol kutusu başta boştur Public CheckBox(String s, CheckBoxGroup c,boolean durum) Tekbir daire şeklinde kontrol kutusu oluşturur ve bu kontrol kutusunu CheckBoxGroup nesnesine ilave eder. Public CheckboxGroup() CheckboxGroup nesnesini oluşturur bu gruba checkboxlar ilave edilebilir

153

Şekil 7.7.2 CheckBoxTesti.java programının sonuçlarının appletde görülmesi

import java.applet.Applet; import java.awt.*; import java.awt.event.*;

ww w. ja

public void init() { setBackground(Color.lightGray); //bos textField T=new TextField("Buradaki yazinin degismesini izleyiniz"); add(T); fontGurubu=new CheckboxGroup(); Normal=new Checkbox("Normal",fontGurubu,true); Normal.addItemListener(this); add(Normal); Kalin=new Checkbox("Kalin",fontGurubu,true); Kalin.addItemListener(this); add(Kalin); Italic=new Checkbox("Italik",fontGurubu,true); Italic.addItemListener(this); add(Italic); KalinItalic=new Checkbox("Kalin Italik",fontGurubu,true); KalinItalic.addItemListener(this); add(KalinItalic); NormalFont=new Font("Serif",Font.PLAIN,14); KalinFont=new Font("Serif",Font.BOLD,14); ItalicFont=new Font("Serif",Font.ITALIC,14); KalinItalicFont=new Font("Serif",Font.BOLD+Font.ITALIC,14); T.setFont(NormalFont); } public void itemStateChanged(ItemEvent e) {

va
153

public class RadiobuttonTesti extends Applet implements ItemListener { private TextField T; private Font NormalFont,KalinFont,ItalicFont,KalinItalicFont; private Checkbox Normal,Kalin,Italic,KalinItalic; private CheckboxGroup fontGurubu;

dil

Şimdi de checkBoxGroup programının çalışmasını ornekleyen RadioButtonTesti programına göz atalım.

i.c o

m

154

Şekil 7.7.3 RadioButtonTetsi.java programı ve sonuçlarının applette gösterilmesi 7.8 Mouse(Fare) kontrolu

ww w. ja

Modern bilgisayarlarda bilgisayar işlemlerinin çok büyük bir kısmı mouse (fare) ile kontrol edilir. Javada temel fare kontrollarını sağlayan sınıflar MouseListener ve MouseMotionListener sınıflarıdır.

Bu sınıfların en çok kullanılan metotları şunlardır : 1. MouseListener Metotları : public void mousePressed(MouseEvent e) bir mouse düğmesi basılınca çağırılır public void mouseClicked(MouseEvent e) bir mouse düğmesi basılıp bırakılırsa çağırılır. public void mouseReleased(MouseEvent e) Bir mouse düğmesi basılı olarak mouse çekildikten sonra düğme bırakılınca çağırılır. public void mouseEntered(MouseEvent e) mouse pencere içine girince çağırılır. public void mouseExited(MouseEvent e) mouse pencere çerçevesinin dışındaysa çağırılır. 2. MouseMotionListener Metotları public void mouseDragged(MouseEvent e) Mouse düğmesi basılı iken mouse hareket ettirilirse çağırılır public void mouseMoved(MouseEvent e) Mouse hareket ederse çağırılır.

va
154

dil

i.c o

int KalinAyari; if(e.getSource()== Normal) {T.setFont(NormalFont);} else if(e.getSource()== Kalin) {T.setFont(KalinFont);} else if(e.getSource()== Italic) {T.setFont(ItalicFont);} else if(e.getSource()== KalinItalic) {T.setFont(KalinItalicFont);} } }

m

155

import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class FareTesti extends Applet implements MouseListener, MouseMotionListener { private int nx,ny=-10; private String s=""; public void init() { addMouseListener(this); addMouseMotionListener(this); }

ww w. ja
}

//fare dinleyicisinin dinledikleriyle ilgili cikti metodlari public void mouseClicked(MouseEvent e) { degerleriGir("Kliklendi",e.getX(),e.getY()); } public void mousePressed(MouseEvent e) { degerleriGir("Basildi",e.getX(),e.getY()); } public void mouseReleased(MouseEvent e) { degerleriGir("Birakildi",e.getX(),e.getY()); } public void mouseEntered(MouseEvent e) { showStatus("Fare applet alani icinde"); } public void mouseExited(MouseEvent e) { showStatus("Fare applet alani disinda"); } //MouseMotionListener (fare hareket dinleyicisi) metotlari public void mouseDragged(MouseEvent e) { degerleriGir("basilip cekiliyor",e.getX(),e.getY()); } public void mouseMoved(MouseEvent e) { degerleriGir("hareket halinde",e.getX(),e.getY()); }

va
155

public void degerleriGir(String e,int x,int y) { s=e; nx=x; ny=y; repaint(); }

dil

public void paint(Graphics g) { g.drawString(s+"["+nx+","+ny+"]",nx,ny); }

i.c o

m

Bu metotların kullanımlarını göstermek amacıyla FareTesti.java programı aşağıda verilmiştir.

156

List sınıfı bir listeden seçim yapmaya ve bu seçim sonucu gerekli işlemleri oluşturmaya yarar. IemListener ve ActionListener sınıf implementlerini kullanır.

public class ListTesti extends Applet implements ActionListener,ItemListener { private List renkListesi; private String renkIsmi[]={"Siyah","Mavi","Cam Gobegi","Koyu Gri","Gri", "Yesil","Acik gri","Mor","Portakal","Pembe","Kirmizi","Beyaz","Sari"}; private Color C[]={Color.black,Color.blue,Color.cyan,Color.darkGray, Color.gray,Color.green,Color.lightGray,Color.magenta,Color.orange, Color.pink,Color.red,Color.white,Color.yellow}; public void init() { //Ekranda 5 isim g”r lebilecel bir liste ac //ayn ismi birden fazla tekrarlama renkListesi=new List(5,false); renkListesi.addActionListener(this); renkListesi.addItemListener(this); //listeye ekle for(int i=0;i<renkIsmi.length;i++) { renkListesi.add(renkIsmi[i]); } add(renkListesi); }

ww w. ja
}

public void actionPerformed(ActionEvent e) { setBackground(C[renkListesi.getSelectedIndex()]); repaint(); } public void itemStateChanged(ItemEvent e) { showStatus(renkListesi.getSelectedItem()+"; indeks : "+ renkListesi.getSelectedIndex()); }

va
156

dil

i.c o

import java.applet.Applet; import java.awt.*; import java.awt.event.*;

m

7.9 List sınıfı, listeden seçim

157

Şekil 7.9.1 ListTetsi.java programı ve sonuçların appletviewer da görünümü 7.10 FlowLayout sınıfı kullanarak GUI formatlanması

import java.applet.Applet; import java.awt.*; import java.awt.event.*;

ww w. ja

public class FlowLayoutTesti extends Applet implements ActionListener { private Button B[]; public void init() { B=new Button[3]; B[0]=new Button("Sol"); B[1]=new Button("Orta"); B[2]=new Button("Sag"); for(int i=0;i<B.length;i++) { B[i].addActionListener(this); add(B[i]); } } public void actionPerformed(ActionEvent e) { int pozisyon=FlowLayout.LEFT;; if(e.getSource()==B[0]) { pozisyon=FlowLayout.LEFT; } else if(e.getSource()==B[1]) { pozisyon=FlowLayout.CENTER; } else if(e.getSource()==B[2]) { pozisyon=FlowLayout.RIGHT; } setLayout(new FlowLayout(pozisyon)); validate(); } }

va
157

dil

Küçuk bir örnek problemle FlowLayout kullanımını daha açık hale getirebiliriz.

i.c o

Flow layout sınını appletde tyer alan GUI lerin sag dol ve ortada formatlanmasını saglar. Kurucu metodu şu şekillerde tanımlanır : public Flowlayout() public Flowlayout(int formatbolgesi) formatbolgesi FlowLayout.RIGHT, FlowLayout.CENTER veya FlowLayout.LEFT değerlerini alabilir. public Flowlayout(int formatbolgesi,int yatay_bosluk,int dikey_bosluk) formatbolgesi FlowLayout.RIGHT, FlowLayout.CENTER veya FlowLayout.LEFT değerlerini alabilir. Yatay_bosluk pixel olarak yatay posisyonda elemanlar arasında kalan boslugu gosterir. Dikey bosluk ise dikey dogrultudaki pixel olarak boşluktur.

m

158

Şekil 7.10.1 FlowLayout sınıfı ve sonuçlarının Appletde görülmesi 7.11 BorderLayout sınıfı kullanarak GUI formatlanması

ww w. ja

import java.applet.Applet; import java.awt.*; import java.awt.event.*;

public class BorderLayoutTesti extends Applet implements ActionListener { private Button B[]; private String S[]={"Kuzeyi Gizle","Guneyi Gizle","Doguyu Gizle", "Batiyi Gizle","Ortayi Gizle"}; public void init() { setLayout(new BorderLayout(5,5)); B=new Button[5]; for(int i=0;i<B.length;i++) { B[i]=new Button(S[i]); B[i].addActionListener(this); } add(B[0],BorderLayout.NORTH); add(B[1],BorderLayout.SOUTH); add(B[2],BorderLayout.EAST); add(B[3],BorderLayout.WEST); add(B[4],BorderLayout.CENTER); }

va
158

BorderLayout sınıfı GUI elemanlarını beş bolgeye ayırarak guruplar, kuzey(NORTH), güney(SOUTH), dogu(EAST),Batı(WEST),orta(CENTER), Kuzey Appletin üst ısmı anlamına gelir. BorderLAyout sınıfının kurucu metodları şunlardır : public BorderLayout() public BorderLayout(int yatay_bosluk,int dikey_bosluk); yatay_bosluk ve dikey_basluk pixel olarak alınır. GUI elemanlarının arasındaki bosluk miktarını tanımlar. Şimdi bir örnekle sınıfı açıklamaya çalışalım.

dil

i.c o

m

159

}

Şekil 7.11.1 BorderLayoutTesti.java programı

ww w. ja
159

va

dil

i.c o

public void actionPerformed(ActionEvent e) { for(int i=0;i<B.length;i++) { if(e.getSource()==B[i]) B[i].setVisible(false); else B[i].setVisible(true); } validate(); }

m

160

Şekil 7.11.2 BorderLayoutTesti.java programının sonuçlarının applette görulmesi 7.12 GridLayout sınıfı kullanarak GUI formatlanması

GridLayout sınıfı appleti eşit boyutta gridlere böler ve her grid elemanının içine bir GUI yerleştirilebilmesine olanak sağlar. GridLayout sınıfının kurucu metodları şöyledir : public GridLayout(int satırlar,int sütunlar)
publicGridLayout(int satırlar,int sütunlar, int yatay_bosluk,int dikey_bosluk); yatay_bosluk ve dikey_basluk pixel olarak alınır. GUI elemanlarının arasındaki bosluk miktarını tanımlar. Şimdi bir örnekle sınıfı açıklamaya çalışalım.

import java.applet.Applet; import java.awt.*; import java.awt.event.*;

ww w. ja

public class GridLayoutTesti extends Applet { private Button B[]; private String S[]={"1","1","3", "4","5","6"}; public void init() { setLayout(new GridLayout(3,2,5,5)); B=new Button[6]; for(int i=0;i<B.length;i++) { B[i]=new Button(S[i]); add(B[i]); } } }

va
160

dil

i.c o

m

161

Şekil 7.12.1 BorderLayoutTesti.java programı ve sonuçlarının applette görulmesi 7.13 Panel sınıfı

Daha kompleks formatlamalara gereksinme duyulduğunda panel sınıfını kullanabiliriz. Panel sınıfı applete yerleştirebileceğimiz alt bolgeler oluşturur. Hemen bir ornekle paneli nasıl kulandığımızı açıklamaya çalışalım.
import java.applet.Applet; import java.awt.*; import java.awt.event.*;

ww w. ja
import java.awt.*; import java.applet.Applet; import java.awt.event.*;

Şekil 7.13.1 PanelTesti.java programı ve sonuçlarının applette görulmesi

Şu ana kadarki format örneklerinde anlatımı basitleştirmek amacıyla hep düğmeler (button) kullandık. Şimdi de başka bir problemde Layout sınıfının kullanılmasına bakalım :

public class PolinomunKokleri extends Applet implements ActionListener { // polinom a*x^2+b*x+c=0 private Panel YaziPaneli; Label prompt1; Label prompt2;

va
161

public class Paneltesti extends Applet { private Panel buttonPanel; private Button buttons[]; public void init() { buttonPanel=new Panel(); buttons=new Button[5]; buttonPanel.setLayout(new GridLayout(1,buttons.length)); for(int i=0;i<buttons.length;i++) { buttons[i]=new Button("Button "+(i+1)); buttonPanel.add(buttons[i]); } setLayout(new BorderLayout()); add(buttonPanel,BorderLayout.SOUTH); } }

dil

i.c o

m

162

ww w. ja

public void init() { setBackground(Color.lightGray); YaziPaneli=new Panel(); YaziPaneli.setFont(new Font("Serif",Font.BOLD,12)); YaziPaneli.setLayout( new GridLayout(4,2) ); prompt1=new Label("a*x^2+b*x+c = 0"); prompt2=new Label("Polinomunun kokleri"); prompta=new Label(" a : "); inputa =new TextField(5); inputa.addActionListener(this); promptb=new Label(" b : "); inputb =new TextField(5); inputb.addActionListener(this); promptc=new Label(" c : "); inputc =new TextField(5); inputc.addActionListener(this); YaziPaneli.add(prompt1); YaziPaneli.add(prompt2); YaziPaneli.add(prompta); YaziPaneli.add(inputa); YaziPaneli.add(promptb); YaziPaneli.add(inputb); YaziPaneli.add(promptc); YaziPaneli.add(inputc); add(YaziPaneli); }

public void paint(Graphics g) { g.setColor(Color.blue); g.setFont(new Font("Serif",Font.BOLD,14)); g.drawString("Polinomun Kokleri: ",70,175); g.setColor(Color.black); g.setFont(new Font("Serif",Font.BOLD,12)); if(delta<0) { g.drawString("Kok 1 :"+(-b/2.0/a)+"+ i* "+Math.sqrt(delta)/2.0/a,100,190 ); g.drawString("Kok 2 :"+(-b/2.0/a)+"- i* "+Math.sqrt(delta)/2.0/a,100,205); } if(delta==0) { g.drawString("Kok 1 :"+(-b/2.0/a),100,190 ); g.drawString("Kok 2 :"+(-b/2.0/a),100,205 ); } if(delta>0) {

va
162

dil

i.c o

Label prompta; TextField inputa; Label promptb; TextField inputb; Label promptc; TextField inputc; double a,b,c; double delta=0.0; double x1,x2;

// // // // // //polinomun katsayilari //determinant //kokler

m

163

}

}

ww w. ja
JAVA PROGRAMLAMA DİLİ HAFTA 11 Bu haftaki incelenecek programlar : LABELT~1 BAYAGI~1 BUTTON~1 TEXTFI~1 CHECKB~1 FARETE~1 JAV JAV JAV JAV JAV JAV 428 7.866 807 686 847 1.258 22/06/98 22/06/98 23/06/98 23/06/98 23/06/98 23/06/98 Bu haftaki Alıştırmalar

Şekil 7.13.2 İkinci dereceden denklemin koklerini hesaplayan PolinomunKokleri.java programı ve sonuçlarının applette görulmesi

ALISTIRMA 1

va
23:49 23:21 0:31 0:45 1:32 2:08 LabelTesti.java bayagikesir.java ButtonTesti.java TextFieldTesti.java CheckBoxTesti.java FareTesti.java 163

dil

i.c o

public void actionPerformed( ActionEvent e) { Double sayi1=new Double(inputa.getText() ); Double sayi2=new Double(inputb.getText() ); Double sayi3=new Double(inputc.getText() ); a=sayi1.doubleValue(); b=sayi2.doubleValue(); c=sayi3.doubleValue(); delta=b*b-4.0*a*c; repaint(); }

m

x1=-b/2.0/a+Math.sqrt(delta)/20/a; x2=-b/2.0/a-Math.sqrt(delta)/2.0/a; g.drawString("Kok 1 :"+x1,100,190 ); g.drawString("Kok 2 :"+x2,100,205); }

164

FareTesti.java programını ve gecen hafta incelediğimiz drawRect metodunu birleştirerek fareyi kallanarak ekrana dikdortrtgen çizdiriniz (dikdortgenin baslangic ve bitis noktaları fare tarafindan belirlenecektir) ALISTIRMA 3

FareTesti.java programını ve gecen hafta incelediğimiz drawOval metodunu birleştirerek fareyi kallanarak ekrana daire çizdiriniz (dairenin merkezi ve capı fare tarafindan belirlenecektir)
HAFTA 12 JAVA PROGRAMLAMA DILI

Bu haftaki incelenecek dosyalar PANELT~1 JAV RADIOB~1 JAV ALIŞTIRMA 1 527 1.473

30/06/98 25/06/98

Appletin alt bölgesinde(SOUTH) iki sıra, her sırada beşer dügmeden on düğme bulunan bir applet oluşturunuz.. Appletin tepesinde bir TextField oluşturunuz. Her dügmeye basıldığında textfieldde degişik bir yazı görünsün. Yazıları 2x5 lik bir String değişkeninden okuyarak Text fielde yükleyiniz.

ww w. ja
import java.applet.Applet; import java.awt.*; import java.awt.event.*; private Panel buttonPanel; private Button buttons[]; String s[]= {"Birinci Butona Basildi", "Ikinci Butona Basildi", "Ucüncü Butona Basildi", "Dordüncü Butona Basildi", "Besinci Butona Basildi", "Altinci Butona Basildi", "Yedinci Butona Basildi", "Sekizinci Butona Basildi", "Dokuzunccu Butona Basildi", "Onuncu Butona Basildi"}; TextField T; public void init() {

public class Panel10 extends Applet implements ActionListener {

va
164

dil

17:57 RadiobuttonTesti.java

i.c o
6:52 Paneltesti.java

ALISTIRMA 2

m

FareTesti.java programını ve gecen hafta incelediğimiz cizgiciz programını birleştirerek fareyi kallanarak ekrana cizgi çizdiriniz (cizginin baslangic ve bitis noktaları fare tarafindan belirlenecektir)

165

T=new TextField(s[0]); buttonPanel=new Panel(); buttons=new Button[10]; buttonPanel.setLayout(new GridLayout(2,buttons.length/2)); for(int i=0;i<buttons.length;i++) { buttons[i]=new Button("Button "+(i+1)); buttons[i].addActionListener(this); buttonPanel.add(buttons[i]); } setLayout(new BorderLayout()); add(buttonPanel,BorderLayout.SOUTH); add(T,BorderLayout.NORTH); } public void actionPerformed(ActionEvent e) { for(int i=0;i<buttons.length;i++) { if(e.getSource()==buttons[i]) T.setText(s[i]);} validate(); } }

ww w. ja

8. JAVADA HATA ANALİZİ VE YAKALANMASI

Javada diğer dillerden farklı olarak dil yapısının içinde hataları yakalamak için oldukça gelişmiş bir sistem mevcuttur. Eger javada kontrol edilmemiş bir hata oluşursa program durur ve hatayı yazar. Biz hata oluştuğunda hata kontrol sisteminde hatayı kontrol edip programı çalıştırmaya devam edebiliriz. Javadaki hata kontrol bloğu şu şekilde yazılır :

try { java deyimleri; java kaynaklarından herhangi birini kullanan deyimler } catch( herhangibirtürException e1) { exception kontrol deyimleri } catch( diğerherhangibirtürException e1) { exception kontrol deyimleri } finally { deyimler

va
165

dil

i.c o

m

166

Javadaki Exception türleri aşağıdaki listede verilmiştir : Java.lang hata listesi AbstractMethodError ClassCircularityError ClassFormatError Error ExceptionInInitializerError IllegalAccessError IncompatibleClassChangeError InstantiationError InternalError LinkageError NoClassDefFoundError NoSuchFieldError NoSuchMethodError OutOfMemoryError StackOverflowError ThreadDeath UnknownError UnsatisfiedLinkError VerifyError VirtualMachineError Java.lang Exception listesi ArithmeticException ArrayIndexOutOfBoundsException ArrayStoreException ClassCastException ClassNotFoundException CloneNotSupportedException Exception IllegalAccessException IllegalArgumentException IllegalMonitorStateException IllegalStateException IllegalThreadStateException IndexOutOfBoundsException InstantiationException InterruptedException NegativeArraySizeException NoSuchFieldException NoSuchMethodException NullPointerException NumberFormatException RuntimeException SecurityException

ww w. ja
166

va

dil

i.c o

m

java kaynağını serbest bırakma deyimleri }

167

StringIndexOutOfBoundsException Java.util exception listesi EmptyStackException MissingResourceException NoSuchElementException TooManyListenersException Java.io exception listesi CharConversionException EOFException FileNotFoundException IOException InterruptedIOException InvalidClassException InvalidObjectException NotActiveException NotSerializableException ObjectStreamException OptionalDataException StreamCorruptedException SyncFailedException UTFDataFormatException UnsupportedEncodingException WriteAbortedException Şekil 8.1 Java hata ve exception listesi

ww w. ja
public class sifiraBolunmeException extends ArithmeticException { public sifiraBolunmeException() { super("sifira bolmeye calistiniz "); }

Java hata oluştuğununda hatanın oluştuğu metodun girişinde kullanılan throws kelimesini takip eden Exception sınıfıyla aynı exception gurubunu yaşıyan try-catch gurubuna aktarır. Bu metodun içinde gerekli noktada (hatanın oluşacağı şartda) throw deyimi kullanılarak hata oluştuğu aktarılır ve bu aktarım try-catch gurubu tarafından yakalanır ve işleme alınır.

Hata kontrolunu daha iyi açıklayabilmek amacıyla bir örnek vermek istiyoruz. SifiraBölünmeException sinifinda yeni bir hata kontrol sinifi yaratiyoruz. Bu sinif ve java kütüphanesinde mevcut olan tamsayı format hatası (NumberFormatException) sifirebolmetesti programında test edilmiştir. Sonuçlar applet çıktılarında görülmektedir. Eğer bu hatalar kontrol edilmeseydi, java programı hata vererek çalışmasını durdururdu. Programdaki hata kontrol deyimleri kalın harfle verilmiştir. Hata kontrol bloğu ise italik olarak verilmiştir.

va
167

dil

i.c o

m

168

}

Şekil 8.2 Bizim tarafımızdan oluşturulan sifiraBolunmeException.java hata kontrolü programı
import import import import import java.applet.Applet; java.awt.*; java.awt.event.*; java.text.DecimalFormat; sifiraBolunmeException;

public class sifirebolmetesti extends Applet implements ActionListener { private Label L1,L2; private TextField T1,T2; private int sayi1,sayi2; private double sonuc; public void init() { sayi1=0; sayi2=1; L1=new Label("Payi gir : "); L2=new Label("Paydayi gir : "); T1=new TextField(10); T2=new TextField(10); T2.addActionListener(this); add(L1); add(T1); add(L2); add(T2); }

ww w. ja

public double bol(int s1,int s2) throws sifiraBolunmeException { if(s2==0) throw new sifiraBolunmeException(); return (double) s1/s2; } public void actionPerformed(ActionEvent e) { DecimalFormat hassaslik3=new DecimalFormat("#.000"); try{ sayi1=Integer.parseInt(T1.getText()); sayi2=Integer.parseInt(T2.getText()); T1.setText(""); T2.setText(""); sonuc=bol(sayi1,sayi2); showStatus(sayi1+" / "+sayi2+" = "+hassaslik3.format(sonuc)); } catch(NumberFormatException nfe) {showStatus("iki tam sayi girmelisiniz.");} catch(sifiraBolunmeException sbh) {showStatus(sbh.toString());} } }

va
168

dil

i.c o

m

169

Şekil 8.2 Bizim tarafımızdan oluşturulan sifiraBolunmeException.java hata kontrolü ve sayı formatı hata kontrolü (NumberFormatException) yapan sifirebolmetesti.java programı ve sonuçlarının applet ekranında izlenimi Prgramlarda da görüldüğü gibi hata programın calismasına engel olmaksızın kullanıcıya bildirilmektedir. Bu program gurubunda once ArithmeticException sınıfından sıfıraBolunmeException sınıfı türetilmiştir. Sonra programın içindeki
public double bol(int s1,int s2) throws sifiraBolunmeException { if(s2==0) throw new sifiraBolunmeException(); return (double) s1/s2; }

ww w. ja
try{ }

metodunda metodun once throws sifiraBolunmeException deyimiyle exception gondereceği bildirilmiş, ve metodun içinde if(s2==0) throw new sifiraBolunmeException();

deyimiyle exception ( hata değişkeni) gönderilmiştir. Gönderilen hata değişkeni (exception)
sayi1=Integer.parseInt(T1.getText()); sayi2=Integer.parseInt(T2.getText()); T1.setText(""); T2.setText(""); sonuc=bol(sayi1,sayi2); showStatus(sayi1+" / "+sayi2+" = "+hassaslik3.format(sonuc)); } catch(NumberFormatException nfe) {showStatus("iki tam sayi girmelisiniz.");} catch(sifiraBolunmeException sbh) {showStatus(sbh.toString());} }

gurubu tarafından yakalanmış, ve eğer sıfır hatası varsa

va
169

dil

i.c o

m

170

showStatus("iki tam sayi girmelisiniz."); işlemini çağırmıştı bu işlem sonunda applet sifiraBolunmeException sınıfının toString metodunu kullanarak

Ayrıca yukardaki program parçacığında da görüldüğü gibi programımız aynı zamanda NumberFormatException nfe terimiyle integer olan rakamımızın integer olarak gönderilip gönderilmediğini kontrol etmektedir. Bu exception java küyüphanesindeki parsInt metodu tarafından gönderilmektedir.

ww w. ja
170

va

dil

i.c o

sifiraBolunmeException:sıfıra bolmeye calıstınız mesajını vermiştir.

m

catch(sifiraBolunmeException sbh) deyimi tarafından yakalanmiş ve

171

ww w. ja
public class saat extends Applet { Font F;

CPU nun Parelel kullanımı Runnable interface’i veya abstract Thread sınıfıni kullanarak gerçekleştirilir. Aşağıda Bu iki yolu kullanarak bir digital saat programı oluşturulmuştur. Bu programlarda saat sadece tek bir program olmasına rağmen bilgisayarın belleğinde eğer devamlı çalıştırılacak olursa başka hiçbir programın çalıştırılamıyacağı düşünülerek paralel kullanımlı olarak verilmiştir.
import java.awt.Graphics;import java.awt.Font;import java.util.*;import java.applet.Applet;import java.text.*; class saatThread extends Thread { Applet a; public saatThread(Applet ai) {a=ai;} public void run() { while(true) { a.repaint(); try {Thread.sleep(1000);} catch(InterruptedException e) {System.err.println(e.toString());} } } }

va
171

Parelel Kullanım(Multithreading) Tek bir işlemcinin birden fazla program tarafından kullanılmasıdır. Bu kullanım CPU (merkez program işlemcisi) adını verdiğimiz temel bilgisayar işlem ünitesinin çeşitli programlar tarafından ortaklaşa kullanılması prensibine göre yapılır. Bilgisayar CPU zamanı küçük parçalara bölünerek her parçada ayrı bir bilgisayar programının çalışması ve diğer bilgisayar programlarının beklemesi sağlanır. Programlar küçük paketçikler halinde program işlemcisine gönderilir ve sonuçlar tekrar hafızaya aktarılır. Sonra ikinci bir program parçacığı işlemci belleğine gönderilir. Modern seri bilgisayarlarda cache adı verilen bu program parçacıkları çalışırken diğer program parçacıklarını tutabilen hizli hafıza birimleri de bulunur.Tüm bu kontrolları ve birden fazla programın tek işlemcide çalışma işlemini java dilinde doğrudan programlayabiliriz.

dil

i.c o

İşlemleri tek tek sırayla ve iyi bir şekilde yapabilseydik belki de ok mükemmel sonuçlar alabilirdik. Fakat Dünyadaki hemen hemen hiçbirşey tek tek sırayla çalışmaz. İnsan vücudu da dajhil bir çok doğal sistemler paralel olark çalışır. Yani bir işlem yapılırken parelelinde diğer bir işlem yapılmaya devam eder. Bizim şu anda kullandığımız bilgisayarların büyük bir bölümü tek bir işlemciye(processor) sahiptir. Birden fazla işlemciye sahip paralel bilgisayarlarda, her bir işlemcide bir iş tanımlayarak paralel kullanım mümkündür. Fakat tek işlemcili sistemler için(seri bilgisayar) yazılmış olan program dilleri genel olarak birden fazla işlemin aynı anda yapılmasına izin vermezler. Modern bilgisayar dilleri arasında sadece Ada ve Java dilleri bir işlemcide birden fazla işlemin (programın) aynı anda kullanılmasına izin verir. C++ dili birden fazla programın aynı anda kullanılmasına izin vermez. Bu yüzden tek kullanımlı bir programlama dilidir.

m

10. PARELEL KULLANIM (MULTITHREADING)

172

}

Şekil 9.1 Saat.java sınıfının thread sınıfından türemiş olarak yazılımı.

ww w. ja
public void start() { if(runner==null) { runner=new Thread(this); runner.start(); } } public void stop() { if(runner!=null) { runner.stop(); runner=null; } } public void run() {

import java.awt.Graphics;import java.awt.Font;import java.util.Date;import java.applet.Applet; public class saat extends Applet implements Runnable{ Font theFont=new Font("TimesRoman",Font.BOLD,24); Date theDate; Thread runner;

va
172

dil

public void paint(Graphics g) { df.format(D); D=new Date(); g.setFont(F); try { g.drawString(D.toString(),10,50); } catch(NullPointerException e){} }

i.c o

public void init() { F=new Font("TimesRoman",Font.BOLD,24); tr=new Locale("tr","TR"); D=new Date(); df= DateFormat.getDateInstance(DateFormat.LONG,tr); r=new saatThread(this); r.start(); }

m

Date D; DateFormat df; Locale tr; saatThread r;

173

public void paint(Graphics g) { g.setFont(theFont); try { g.drawString(theDate.toString(),10,50); } catch(NullPointerException e){} } }

ww w. ja
class UretInteger extends Thread {

Şekil 9.1 Saat.java sınıfının Runnable interface’i ile yazılımı ve applet çıktısı

Programlardan da görüldüğü gibi thread adı verilen ve bilgisayar belleğinde diğer programlarla beraber çalışmasını istediğimiz program parçacıklarını java programının içinde başlatabiliriz(start), kontrol edebiliriz veya durdurabiliriz(stop). Program parçacığının çalışmadan bekleyeceği sureyi de sleep metotunu kullanarak ayarlıyabiliriz.

İkinci olarak biraz daha karışık bir örneğe göz atalım. Bu örnekte, iki tane program bilgisayar belleginde aynı anda çalışacaktır. Birinci program ikinci programla ortak olarak kullanılan bir bilgisayar int hafıza noktasına sırasıyla birden ona kadar değişen bir rakam yazacak, ikinci program da aynı noktadan (OrtakHucreden) yazılan değeri okuyacaktır.

class OrtakHucre{ public static void main(String args[]) { TutInteger h=new TutInteger(); UretInteger p=new UretInteger(h); KullanInteger c= new KullanInteger(h); p.start(); c.start(); } }

va
173

dil

i.c o

}

m

while(true) { theDate=new Date(); repaint(); try {Thread.sleep(1000);} catch(InterruptedException e) {} }

174

private TutInteger pTut; public UretInteger(TutInteger h) { pTut=h; }

try{

} }

}

class KullanInteger extends Thread { private TutInteger cTut;

public void run() { int Intdegeri=0;

ww w. ja
public int getOrtakInt() { return OrtakInt; }

while (Intdegeri !=9) { try{ sleep( (int) (Math.random()*5000)); } catch(InterruptedException e) { System.err.println("Exeption "+e.toString()); System.out.println("Kullan } }} public void setOrtakInt(int

} Intdegeri=cTut.getOrtakInt(); Integer"+Intdegeri+" degerini okudu"); class TutInteger{ private int OrtakInt; Intdegeri) { OrtakInt=Intdegeri; }

va
174

public KullanInteger(TutInteger h) { cTut=h; }

dil

sleep( (int) (Math.random()*5000 ) ); } catch(InterruptedException e) { System.err.println("Exeption "+e.toString()); }

i.c o

public void run() { for(int count=0; count<10; count++) { pTut.setOrtakInt(count); System.out.println("OrtakInteger "+count+" degerini uretti");

m

175

}

ww w. ja

import java.util.*;import java.awt.*;import java.io.*;//runnable interfacei kullanarakclass UretInteger implements Runnable { private TutInteger pTut; private Thread thread; public UretInteger(TutInteger h) { pTut=h; thread = new Thread(this); thread.start(); } public void run() { for(int count=0; count < 10; count++) { pTut.setOrtakInt(count); System.out.println("Ortak Integer " + count+" Olarak olusturuldu"); try { thread.sleep((int)(Math.random()*3000)); } catch(InterruptedException exception) { System.err.println("Exception " + exception.toString()); } } } } class KullanInteger implements Runnable{ private TutInteger cTut; private Thread thread; public KullanInteger(TutInteger h) { cTut = h; thread= new Thread(this); thread.start(); } public void run() { int Intdegeri=0; while(Intdegeri != 9) { try { thread.sleep((int)(Math.random()*3000)); } catch(InterruptedException e) { System.err.println("Exception " + e.toString()); } Intdegeri = cTut.getOrtakInt();

va
175

dil

i.c o

OrtakInteger 0 degerini urettiOrtakInteger 1 degerini urettiOrtakInteger 2 degerini urettiKullan Integer2 degerini okudu OrtakInteger 3 degerini uretti OrtakInteger 4 degerini uretti OrtakInteger 5 degerini uretti Kullan Integer5 degerini okudu Kullan Integer5 degerini okudu OrtakInteger 6 degerini uretti OrtakInteger 7 degerini uretti Kullan Integer7 degerini okudu OrtakInteger 8 degerini uretti OrtakInteger 9 degerini uretti Kullan Integer9 degerini okudu Şekil 9.2 OrtakHucre.java programı ve çıktısı

m

176

public class OrtakHucreR { public static void main(String[] args) { TutInteger h= new TutInteger(); new UretInteger(h); new KullanInteger(h); } }

Şekil 9.3 Runnable interface’i ile çalişan OrtakHucreR.java sınıfı

ww w. ja
class Uretinteger extends Thread { private Tutinteger pTut; private TextArea cikti; public Uretinteger(Tutinteger h) { pTut=h; } try{

import java.awt.*;import java.applet.Applet;import java.text.DecimalFormat;public class OrtakHucreBuf extends Applet{ private TextArea cikti; public void init() { setLayout(new BorderLayout()); cikti = new TextArea(); add(cikti,BorderLayout.CENTER); } public void start() { Tutinteger h=new Tutinteger(cikti); Uretinteger p=new Uretinteger(h); Consumeinteger c= new Consumeinteger(h); p.start(); c.start(); } }

public void run() { for(int count=0; count<10; count++) { pTut.setOrtakint(count); sleep( (int) (Math.random()*500 ) );

va
176

dil

i.c o

System.out.println("Kullan Integer " + Intdegeri+"degerini yakaladi"); } } } class TutInteger { private int OrtakInt; public void setOrtakInt(int Intdegeri) {OrtakInt = Intdegeri;} public int getOrtakInt() { return OrtakInt;} }

m

177

} }

}

class Consumeinteger extends Thread { private Tutinteger cTut;

public Consumeinteger(Tutinteger h) { cTut=h; } public void run() { int intdegeri;

intdegeri=cTut.getOrtakint();

} }

ww w. ja
public Tutinteger(TextArea out) { cikti = out; }

} class Tutinteger { private int Ortakint[] = {9,9,9,9,9}; private boolean writeable = true; private boolean okunabilir = false; private int YerelOku =0, YerelYaz=0; private TextArea cikti;

public synchronized void setOrtakint(int intdegeri) { while (!writeable) { try{ cikti.append(" Beklemede "+intdegeri); wait(); } catch (InterruptedException e)

va
177

while (intdegeri !=9) { try{ sleep( (int) (Math.random()*500)); } catch(InterruptedException e) { System.err.println("Hata "+e.toString()); } intdegeri=cTut.getOrtakint();

dil

i.c o

m

} catch(InterruptedException e) { System.err.println("Hata : "+e.toString()); }

178

{ } }

cikti.append("\t yazilan hucre "+YerelYaz+"\t okunan hucre "+YerelOku); printBuffer(cikti, Ortakint);

}

ww w. ja
writeable=true; intdegeri=Ortakint[YerelOku]; notify(); } return intdegeri;

cikti.append("\n Kullanilan "+intdegeri+" Okundugu Hucre "+YerelOku); YerelOku = ++YerelOku % 5; cikti.append("\t yazilan h cre "+YerelYaz+"\t okunan hucre "+YerelOku); printBuffer(cikti, Ortakint); if (YerelOku==YerelYaz) {okunabilir=false; cikti.append("\niNTEGER DEPOSU BOS"); }

public void printBuffer(TextArea out,int buf[]) {

va
178

public synchronized int getOrtakint() { int intdegeri; while (!okunabilir) { try{ cikti.append(" KULLANMAK iCiN BEKLiYOR "); wait(); } catch (InterruptedException e) { System.err.println("hata:"+e.toString() ); } }

dil

if(YerelYaz==YerelOku) { writeable=false; cikti.append("\nDEPOLAMA YERLER˜ DOLU "); } notify();

i.c o

Ortakint[YerelYaz]=intdegeri; okunabilir = true; cikti.append("\n Uretilen "+intdegeri+" Yazilan YerelYaz = ++YerelYaz % 5;

m
"+YerelYaz);

System.err.println("Hata :"+e.toString() );

179

} }

va
179

Uretilen 0 Yazilan 0 yazilan hucre 1 okunan hucre 0 depo: 0 9 9 9 9 Kullanilan 0 Okundugu Hucre 0 yazilan hucre 1 okunan hucre 1 depo: 0 9 INTEGER DEPOSU BOS Uretilen 1 Yazilan 1 yazilan hucre 2 okunan hucre 1 depo: 0 1 9 9 9 Kullanilan 1 Okundugu Hucre 1 yazilan hucre 2 okunan hucre 2 depo: 0 1 INTEGER DEPOSU BOS Uretilen 2 Yazilan 2 yazilan hucre 3 okunan hucre 2 depo: 0 1 2 9 9 Uretilen 3 Yazilan 3 yazilan hucre 4 okunan hucre 2 depo: 0 1 2 3 9 Kullanilan 2 Okundugu Hucre 2 yazilan hucre 4 okunan hucre 3 depo: 0 1 Uretilen 4 Yazilan 4 yazilan hucre 0 okunan hucre 3 depo: 0 1 2 3 4 Kullanilan 3 Okundugu Hucre 3 yazilan hucre 0 okunan hucre 4 depo: 0 1 Uretilen 5 Yazilan 0 yazilan hucre 1 okunan hucre 4 depo: 5 1 2 3 4 Uretilen 6 Yazilan 1 yazilan hucre 2 okunan hucre 4 depo: 5 6 2 3 4 Uretilen 7 Yazilan 2 yazilan hucre 3 okunan hucre 4 depo: 5 6 7 3 4 Kullanilan 4 Okundugu Hucre 4 yazilan hucre 3 okunan hucre 0 depo: 5 6 Kullanilan 5 Okundugu Hucre 0 yazilan hucre 3 okunan hucre 1 depo: 5 6 Uretilen 8 Yazilan 3 yazilan hucre 4 okunan hucre 1 depo: 5 6 7 8 4 Kullanilan 6 Okundugu Hucre 1 yazilan hucre 4 okunan hucre 2 depo: 5 6 Uretilen 9 Yazilan 4 yazilan hucre 0 okunan hucre 2 depo: 5 6 7 8 9 Kullanilan 7 Okundugu Hucre 2 yazilan hucre 0 okunan hucre 3 depo: 5 6 Kullanilan 8 Okundugu Hucre 3 yazilan hucre 0 okunan hucre 4 depo: 5 6 Kullanilan 9 Okundugu Hucre 4 yazilan hucre 0 okunan hucre 0 depo: 5 6 INTEGER DEPOSU BOS

Şekil 9.4 Buffer ile uyum sağlanmış OrtakHucreBuf.java sınıfı ve applet çıktısı

ww w. ja
p.start(); c.start(); } } class UretInteger extends Thread { private TutInteger pTut; public UretInteger(TutInteger h) { pTut=h; }

class OrtakHucreSyn{ public static void main(String args[]) { TutInteger h=new TutInteger(); UretInteger p=new UretInteger(h); KullanInteger c= new KullanInteger(h);

public void run() { for(int count=0; count<10; count++) { pTut.setOrtakInt(count);

dil

i.c o
9 9 9 9 9 9 2 3 9 2 3 4 7 3 4 7 3 4 7 8 4 7 8 9 7 8 9 7 8 9

m

out.append("\t depo: "); for(int i=0; i<buf.length; i++) out.append(" "+buf[i]);

180

try{

} }

}

class KullanInteger extends Thread { private TutInteger cTut; public KullanInteger(TutInteger h) { cTut=h; } public void run() { int Intedegeri=0;

ww w. ja
} }

while (Intedegeri !=9) { try{ sleep( (int) (Math.random()*3000)); } catch(InterruptedException e) { System.err.println("Exeption "+e.toString()); } Intedegeri=cTut.getOrtakInt(); System.out.println("KullanInteger "+Intedegeri+" yakalad "); }

class TutInteger { private int OrtakInt; private boolean Yazilabilir = true; public synchronized void setOrtakInt(int Intedegeri) { while (!Yazilabilir) { try{ wait(); } catch (InterruptedException e) { System.err.println("Exception:"+e.toString() ); } }

va
180

dil

i.c o

sleep( (int) (Math.random()*3000 ) ); } catch(InterruptedException e) { System.err.println("Exeption "+e.toString()); }

m

System.out.println("UretInteger OrtakInteger degerini"+count+"olarak olusturdu");

181

}

return OrtakInt; } }

ww w. ja

UretInteger OrtakInteger degerini 0 olarak olusturduKullanInteger 0 yakaladıUretInteger OrtakInteger degerini 1 olarak olusturduKullanInteger 1 yakaladı UretInteger OrtakInteger degerini 2 olarak olusturdu KullanInteger 2 yakaladı UretInteger OrtakInteger degerini 3 olarak olusturdu KullanInteger 3 yakaladı UretInteger OrtakInteger degerini 4 olarak olusturdu KullanInteger 4 yakaladı UretInteger OrtakInteger degerini 5 olarak olusturdu KullanInteger 5 yakaladı UretInteger OrtakInteger degerini 6 olarak olusturdu KullanInteger 6 yakaladı UretInteger OrtakInteger degerini 7 olarak olusturdu KullanInteger 7 yakaladı UretInteger OrtakInteger degerini 8 olarak olusturdu KullanInteger 8 yakaladı UretInteger OrtakInteger degerini 9 olarak olusturdu KullanInteger 9 yakaladı

Şekil 9.5 Uyum saglanmış OrtakHucreSync.java sınıfı ve sonuçları

Programlardan da görüleceği gibi UretInteger sınıfı (thread’i) TutInteger sınıfını kullanarak yeni bir integer degeri yaratmakta ve KullanInteger sınıfı da bu değeri ortak hafızadan okumaktadır. Burada orijinal programlarda iki thread’in çalişma sıralarının sırayla gitmamesi problemi çıkmıştır. Bazen UretInteger programı birden fazla çalışmakta bazende KullanInteger programı birden fazla çalışmaktadır. Bunu onlemek için OrtakHucreSync programında TutInteger sınıfının içinde Uyum kontrolü yapılmıştır. boolean yazılabilir değişkenini bir trafik işareti gibi kullanıp UretInteger ve TutInteger threat programlarının sırasıyla işleme girmesi, bu arada diğerinin beklemesi sağlanmıştır. Buradaki zorluk. Bazen bir programın çok fazla bekleyebilmesi olasılığıdır. Bunu engellemek içinde OrtakHucreBuf
181

va

dil

Yazilabilir=true; notify();

i.c o

public synchronized int getOrtakInt() { while (Yazilabilir) { try{ wait(); } catch (InterruptedException e) { System.err.println("Exception:"+e.toString() ); } }

m

OrtakInt=Intedegeri; Yazilabilir=false; notify();

182

ww w. ja
182

va

dil

i.c o

m

programında yazmak için bir yerıne beş integer yeri tanımlanmış, ve okutma ve yazma işlemlerinde iki ayrı kontrol boolean deyimi kullanılmıştır.

183

10. JAVA GİRDİ - ÇIKTI PROGRAMLANMASI

10.1 Javanın I/O (Girdi çıktı ) kütüphanesinde yer alan sınıflar ve interface’ler Java 1.1 java.ıo kütüphanesinde yer alan sınıflar şunlardır :
BufferedInputStream BufferedOutputStream BufferedReader BufferedWriter ByteArrayInputStream ByteArrayOutputStream CharArrayReader CharArrayWriter DataInputStream DataOutputStream File FileDescriptor FileInputStream FileOutputStream FileReader FileWriter FilterInputStream FilterOutputStream FilterReader FilterWriter InputStream InputStreamReader LineNumberInputStream LineNumberReader ObjectInputStream ObjectOutputStream ObjectStreamClass OutputStream OutputStreamWriter PipedInputStream PipedOutputStream PipedReader PipedWriter PrintStream PrintWriter PushbackInputStream PushbackReader RandomAccessFile Reader SequenceInputStream StreamTokenizer StringBufferInputStream StringReader StringWriter Writer

ww w. ja

Bu sınıfların hepsinin genel görevi javaya girdi sağlamak ve çıktı almaktır. Burada bunlardan bir kısmının işlevlerini ve nasıl çalıştıklarını inceleyeceğiz.

va
183

dil

i.c o

m

184

10.2 File (Dosya) sınıfı

File sınıfı girdi çıktı işlemlerini sağlarken, dosya isimleri ve bulundukları dizin ile ilgili bilgi verir. Kurucu metotları şöyledir :

Örnek olarak File f1=new File(“/”); File f2=new File(“/”,”autoexec.bat”); File f3=new File(f1,”autoexec.bat”);

tanımlarını verebiliriz. File sınıfında tanımlanmış olan Metotlar şunlardır.

ww w. ja

canRead() Tanımlanan dosyadan bilgi okunulabilirliğini test eder. canWrite() Tanımlanan dosyaya bilgi yazılabilirliğini test eder. delete() Dosyayı siler equals(Object) Dosya ismini Object te verilen dosya ismiyle karşılaştırır. exists() Dosyanın mevcut olup olmadığını kontrol eder. getAbsolutePath() Dosyanın tam dizin ismini ve dosya ismini verir( co/java/prog/Hosgeldiniz.java). getName() Dosyanın ismini verir.(Hosgeldiniz.java) getParent() Dosyanın içinde bulunduğu dizinin ismini verir.(prog) getPath() dosyanın ismini ve içinde bulunduğu dizinin ismini verir.(prog/Hosgeldiniz.java) isAbsolute() Dosya isminin mutlak isim olup olmadığını kontrol eder.(Eğer dosya ismi co/java/prog/Hosgeldiniz.java olarak verilmişse true değeri verir.) isDirectory() verilen isimin bir dizin ismi olup olmadığını kontrol eder. isFile() verilen isimin birdosya isimi olup olamdığını kontrol eder. lastModified() Dosyanın en son değiştirildiği tarihi verir length() Dosyanın boyutunu Byte olarak verir. list() Verilen dizinin içindeki dosyaların listesini verir. list(FilenameFiltre) Verilen dizinin içindeki Filtre nesnesindeki tanıma uyan dosyaların listesini verir. mkdir() Yeni bir dizin oluşturur. mkdirs() O anda tanımlı olan dizinin içine bir alt dizin oluşturur. renameTo(File) Dosyanın ismini değiştirir. toString() Dosya ve dizin isimleri topluluğunun String değişkeni eşdeğerini verir.

va
184

dil

i.c o

File(String dosya_ismi); File(String dizin_ismi, String dosya_ismi); File(File file_tipi_nesne,String dosya_ismi);

m

185 Bu metotları ufak bir program içinde kullanalım. import java.io.*;

Şekil 10.1.1 FileTesti.java programı

ww w. ja

Dosya ismi : Hosgeldiniz.java Dizin ismi : Hosgeldiniz.java Mutlak Dizin ismi : D:\co\java\prog\Hosgeldiniz.java Ust Dizin ismi : null Mevcut Yazilabilir Okunabilir Dizin degil Dosya Mutlak dizin ismi degil Son Degisiklik : 900410464000 Dosya boyutu : 337 Byte

Şekil 10.1.1 FileTesti.java programının sonucları 10.3 Ardışık (Sequential) dosya yaratılması Java bilgi dosyalarını birbiri ardısıra gelen byte akışı olarak görür. Her dosya dosya-bitiş işaretiyle sonlanır. Yeni bir dosya açıldığında bu dosyayla ilgili bir nesne oluşturulur. Yeni bir java programı açıldığında üç akış nesnesi otomatik olarak açılır. Bunlar System.in , System.out, System.err nesneleridir. Eğer kendimiz bir girdi veya çıktı akış nesnesi oluşturmak istersek FileInputStream veya FileOutputStream sınıfı bir nesne tanımlıyabiliriz. Akısın içindeki değişkenleri sadece byte olarak okumak yerine direk olarak double veya integer gibi değişkenler türünden okumak istersek DataInputStream ve DataOutputStream sınıflarını kullanırız. Genel olarak FileOutputStream ve DataOutputStream sınıflarını aşağıdaki gibi bir arada kullanabiliriz : try{ ciktiakimi=new DataOutputStream(new FileOutputStream(“isim.dat”));} catch(IOException e) {System.err.println(“Dosya acilamadi\n”+e.toString());} Bu deyim bize isim.dat isimli dosyadan bir fileOutputStream aracılığıyla açılan dosyayı DataOutputStream’e çevirip gerçek değişkenler cinsinden akış kanalı açar. Kanal açıldıktan
185

va

dil

class FileTesti { public static void main(String args[]) { File f1=new File("Hosgeldiniz.java"); System.out.println("Dosya ismi : "+f1.getName()); System.out.println("Dizin ismi : "+f1.getPath()); System.out.println("Mutlak Dizin ismi : "+f1.getAbsolutePath()); System.out.println("Ust Dizin ismi : "+f1.getParent()); System.out.println( f1.exists() ? "Mevcut " : " Mevcut degil "); System.out.println( f1.canWrite() ? "Yazilabilir " : " Yazilamaz"); System.out.println( f1.canRead() ? "Okunabilir " : " Okunamaz"); System.out.println( f1.isDirectory() ? "Dizin " : " Dizin degil"); System.out.println( f1.isFile() ? "Dosya " : " Dosya degil"); System.out.println( f1.isAbsolute() ? "Mutlak dizin ismi " : " Mutlak dizin ismi degil"); System.out.println("Son Degisiklik : "+f1.lastModified()); System.out.println("Dosya boyutu : "+f1.length()+" Byte"); } }

i.c o

m

186

sonra aşağıdaki deyimlerden birini kullanarak. Dosyaya bilgi aktarımı yapabiliriz.
import java.io.*; import java.awt.*; import java.awt.event.*;

ww w. ja

public class ardisikDosyaYarat extends Frame implements ActionListener { private TextField hesapIsmiKutusu,isimKutusu,soyIsimKutusu,hesapKutusu; private Button enter,done; private DataOutputStream cikti; private Label H,I,S,P; public ardisikDosyaYarat() { super("Musteri dosyasi Ac"); try{ cikti=new DataOutputStream(new FileOutputStream("musteri.dat")); } catch(IOException e) { System.err.println("Dosya dogru acilamadi\n"+e.toString()); System.exit(1); } setSize(300,150); setLayout(new GridLayout(5,2)); H=new Label("Hesap numarasi :"); add(H); hesapIsmiKutusu=new TextField(); add(hesapIsmiKutusu); I=new Label("isim : "); add(I); isimKutusu=new TextField(20); add(isimKutusu); S=new Label("Soyisim : "); add(S); soyIsimKutusu=new TextField(20); add(soyIsimKutusu); P=new Label("Hesaptaki para : "); add(P); hesapKutusu=new TextField(20); add(hesapKutusu); enter=new Button("Gir"); enter.addActionListener(this); add(enter); done=new Button("Cikis"); done.addActionListener(this); add(done); setVisible(true); } public void hesapEkle() { int accountNumber=0; Double d; if(!hesapIsmiKutusu.getText().equals("")) { try{ accountNumber=Integer.parseInt(hesapIsmiKutusu.getText()); if(accountNumber>0) { cikti.writeInt(accountNumber); cikti.writeUTF(isimKutusu.getText()); cikti.writeUTF(soyIsimKutusu.getText());

va
186

dil

i.c o

m

187

ww w. ja

}

public static void main(String args[]) { new ardisikDosyaYarat(); }

Şekil 10.3.2 ArdisikDosyaYarat.java programı ve sonuclarının Frame çıktısında görülmesi
import java.io.*; import java.awt.*; import java.awt.event.*; public class ardisikDosyaOku extends Frame implements ActionListener { private TextField accountField,firstNameField,lastNameField,balanceField;

va
187

} } public void actionPerformed(ActionEvent e) { hesapEkle(); if(e.getSource()==done) { try{ cikti.close();} catch(IOException io) { System.err.println("Dosya kapatilamadi\n"+io.toString()); } System.exit(0); } }

dil

i.c o

d=new Double(hesapKutusu.getText()); cikti.writeDouble(d.doubleValue()); } hesapIsmiKutusu.setText(""); isimKutusu.setText(""); soyIsimKutusu.setText(""); hesapKutusu.setText(""); } catch(NumberFormatException nfe) { System.err.println("Hesap numarasi tamsayi degisken olamalidir"); } catch(IOException io) { System.err.println("Dosyaya yazarken hata olustu\n"+io.toString()); System.exit(1); }

m

188

ww w. ja

private Button next,done; private DataInputStream input; public ardisikDosyaOku() { super("Musteri dosyasini oku"); try{ input=new DataInputStream(new FileInputStream("musteri.dat")); } catch(IOException e) { System.err.println("Dosya acilamadi\n"+e.toString()); System.exit(1); } setSize(300,150); setLayout(new GridLayout(5,2)); add(new Label("Hesap Numarasi :")); accountField=new TextField(); add(accountField); add(new Label("isim : ")); firstNameField=new TextField(20); add(firstNameField); add(new Label("soyisim : ")); lastNameField=new TextField(20); add(lastNameField); add(new Label("Hesaptaki para : ")); balanceField=new TextField(20); add(balanceField); next=new Button("bir sonraki hesap"); next.addActionListener(this); add(next); done=new Button("cikis"); done.addActionListener(this); add(done); setVisible(true); } public void readRecord() { int account; String first,last; double balance; { try{ account=input.readInt(); first=input.readUTF(); last=input.readUTF(); balance=input.readDouble(); accountField.setText(String.valueOf(account)); firstNameField.setText(first); lastNameField.setText(last); balanceField.setText(String.valueOf(balance)); } catch(EOFException eof) { closeFile(); } catch(IOException io) { System.err.println("Dosyay okurken hata olustu\n"+io.toString()); System.exit(1); } } } public void actionPerformed(ActionEvent e)

va
188

dil

i.c o

m

189

}

ww w. ja

Şekil 10.3.2 ArdisikDosyaOku.java programı ve sonuclarının Frame çıktısında görülmesi ArdisikDosyaYarat.java programında musteri.dat dosyası
try{ cikti=new DataOutputStream(new FileOutputStream("musteri.dat")); } catch(IOException e) { System.err.println("Dosya dogru acilamadi\n"+e.toString()); System.exit(1); }

gurubunu kullanarak açılmıştır. Bu gurubu File sınıfını da kullanarak
File f=new File(“musteri.dat”); f=f.getAbsolutePath(f); try{ cikti=new DataOutputStream(new FileOutputStream(f));

va
189

dil

public static void main(String args[]) { new ardisikDosyaOku(); }

i.c o

private void closeFile() { try{ input.close(); System.exit(0); } catch(IOException e) { System.err.println("Dosya Kapama Hatası oluştu\n"+e.toString()); System.exit(1); } }

m

{ if(e.getSource()==next) readRecord(); else closeFile(); }

190 } catch(IOException e) { System.err.println("Dosya dogru acilamadi\n"+e.toString()); System.exit(1); }

Dosyanın okunması içinse

try{ input=new DataInputStream(new FileInputStream("musteri.dat")); } catch(IOException e) { System.err.println("Dosya acilamadi\n"+e.toString()); System.exit(1); }

gurubunu kullandık. Eğer dosya ismi de değişkende dışarıdan okuduktan sonra ismi File sınıfına yükleyip sonra akış kanalı açabiliriz. Dosyaya yazmak için write(byte B[] )

byte tipi boyutludeğişkeni açılmış olan DataOutputStream kanalına yazar. write(byte B[], int baslangıcindeksi, int indeksboyutu)

ww w. ja
write(int B) int datayı data output stream’e yazar. writeBoolean(boolean B) Boolean değişkeni DataOutputStream’e yazar. writeByte(int) writeBytes(String) writeChar(int)

byte tipi boyutludeğişkeni açılmış olan DataOutputStream kanalına yazar. Baslangiç indeksinden baslar ve indeksboyutu uzunluğundaki kısmı yazar.

int değişkeni byte olarak DataOutputStream’e yazar.

String değişkeni byte boyutlu değişken olarak DataOutputStream’e yazar.

va
190

dil

i.c o

şeklinde de yaratabilirdik. İkinci şekilde dosyayı tanımlarken tam dizin ismini de otomatik olarak tanımlamış olurduk.

m

191

int değişkeni char değişken olarak DataOutputStream’e yazar. writeChars(String)

String değişkeni Char değişken olarak DataOutputStream’e yazar. writeDouble(double)

double değişkeni double değişken olarak DataOutputStream’e yazar. writeFloat(float)

float değişkeni float değişken olarak DataOutputStream’e yazar. writeInt(int)

writeLong(long)

long değişkeni long değişken olarak DataOutputStream’e yazar. writeShort(int)

int değişkeni short (short integer) değişken olarak DataOutputStream’e yazar. writeUTF(String)

String değişkeni unicode UTF-8 formatı karekter boyutu olarak yazar.

ww w. ja
Metotlarından birini kullanabiliriz. Dosyadan okumak için :

read(byte[]) read(byte[], int, int) readBoolean() readByte() 8-bit byte integer okur readChar() unicode karecter(char)okur readDouble() double okur readFloat() float okur readFully(byte[]) byte boyutlu değişkenini, byte[] boyutlu girdi değişkeninin boyutuna göre okur. Reads b.length bytes from this data input stream into the byte array.

va
191

dil

float değişkeni float değişken olarak DataOutputStream’e yazar.

i.c o

m

192

readFully(byte[], int, int) readInt() İnteger okur readLine() Bir satırı satırbaşı yap komutuna kadar okur. Java 1.0 komutudur. 1.1 de kullanılmaması tavsiye edilir. readLong() Long tamsayı değişkeni okur. readShort() Short tamsayı değişkeni okur readUnsignedByte() 8-bitlik işaretsiz tamsayı değişkeni okur. readUnsignedShort() 16-bitlik işaretsiz tamsayı değişkeni okur. readUTF() Unicode karekteri okur. readUTF(DataInput) Unicode Karakterini (Character) DataInput girdi akışından okur. skipBytes(int n) n byte değeri okumadan atlar. Dosya ile işlemler bittikten sonra dosya kapanır.

ww w. ja

private void closeFile() { try{ input.close(); System.exit(0); } catch(IOException e) { System.err.println("Dosya Kapama Hatası oluştu\n"+e.toString()); System.exit(1); } }

closeFile() metodu dosya akışını kapatmak macıyla oluşturulmuştur.

10.4 Raslantısal Ulaşım Dosyası Oku (Random Access File)

Raslantısal Ulaşım Dosyasının (Random Access File) Ardışık Dosya sisteminden temel farkı, Teyp kaydıyla CD kaydı arasındaki fark gibidir. Ardışık dosyalar Teyp kaydı şeklinde birbiri ardı sıra gelen bilgilerden oluşur. Raslantısal Ulaşom sisteminde ise CD gibi herhangi bir kayıta kayıt numarası kullanılarak doğrudan ulaşmak mümkündür. Çok daha çabuk ulaşım olanakları yaratır. Raslantısal Ulaşım dosyası örneği olarak aşağıdaki paketi veriyoruz. Kayit sınıfı tek bir kayıtın yazılıp okunabilmesi için gerekli olan bilgileri içeriyor. Kayıtların hesap numarası, isim, soyisim ve hesaptaki paradan oluştuğunu kabul ediyoruz. Bütün bu kayıtları bir arada yapmak için oku ve yaz metodları bu sınıfın içindr tanımlanmıştır. Raslantısal ulaşım kanalının dosyaya açılması için :

va
192

dil

i.c o

m

193 try{ girdi=new RandomAccessFile("musteri1.dat","rw"); } catch(IOException e) { System.err.println("Dosya acma hatasi\n"+e.toString()); System.exit(1); }

yapısı kullanbilir. Buradaki “rw” yapısı dosyaya hem yazı yazılıp hem okunabileceğini belirtir. “r” sadece okumak için “w” sadece yazmak için kullanılır. RandomAccessFile gurubunun içinde yer alan metodlar şunlardır : close()

RandomAccessFile (Raslantısal Ulaşım Dosyası) kanalını ve ilgili tüm sınıfları kapatır. Rnek olarak :
private void closeFile() { try{ girdi.close(); System.exit(0); } catch(IOException e) { System.err.println("Error closing filr\n"+e.toString()); System.exit(1); } }

metodu verilebilir.

ww w. ja
length() Dosyadaki toplam referans sayısını verir.

getFD() dosya (File) tanımını verir

getFilePointer() Dosyanın (File) o anda hangi dosya referansını gösterdiğini belirtir.

read() Byte (char değişkeni karşılığı) olarak dosyadan bilgiyi okur (bir byte). read(byte[]) Byte (char değişkeni karşılığı) olarak dosyadan bilgiyi okur (byte[] değişkeninin boyu kadar) ve byte degişkenine aktarır. read(byte[], int baslangıç_indisi, int indis_boyutu) Byte (char değişkeni karşılığı) olarak dosyadan bilgiyi okur (byte[] değişkeninin boyu kadar, başlangıç indisinden başlayarak, indis_boyutu uzunluğunda) ve byte degişkenine aktarır.

va
193

dil

i.c o

m

194

readBoolean() boolean değişken okur readByte() dosyadan integer tipi byte değişken (işaretli 8-bit ) okur. readChar() Dosyadan Unicode karekter (character) okur. readDouble() Dosyadan double değişkeni okur. readFloat() Dosyadan float değişkeni okur. readFully(byte[] b)

b.length bouyutundaki byte değerini boyutlu byte değişkenine aktarır.

readInt()

Dosyadan int değişkeni okur. readLine()

ww w. ja
readLong() Dosyadan Long (Long integer) değişkeni okur. readShort() Dosyadan Short (Short integer) değişkeni okur. readUnsignedByte() İşaretsiz 8 bitlik integer değeri okur. readUnsignedShort() İşaretsiz 16 bitlik Short integer değeri okur.

Dosyadan “\n” = yeni satır işaretini görene kadar yazılan her şeyi bütün bir satır olarak okur.

va
194

readFully(byte[] b, int baslangıç_indisi, int toplam_boy)

dil

i.c o

m

195

readUTF() UTF stringi okur seek(long) indisi herhangi bir bilgi gurubu indisine ayarlar. skipBytes(int n) n bit input değerini okumadan atlar

Aşağıdaki tanımlar read tanımlarına parelel olan write terimleridir. write(byte[]) write(byte[], int, int) write(int) writeBoolean(boolean) writeByte(int) writeBytes(String) writeChar(int) writeChars(String) writeDouble(double) writeFloat(float) writeInt(int)

ww w. ja
writeLong(long) writeShort(int) writeUTF(String) Şimdi de ornek programın listesini verelim:
import java.io.*; public class Kayit { private int hesap; private String soyIsim; private String Isim; 195

va

dil

i.c o

m

196

ww w. ja
}

public public public public public public public public public

void yazhesap(int a) {hesap = a;} int okuhesap() {return hesap;} void yazIsim(String f){Isim=f;} String okuIsim() {return Isim;} void yazsoyIsim(String f){soyIsim=f;} String okusoyIsim() {return soyIsim;} void yazhesaptakiPara(double b) {hesaptakiPara=b;} double okuhesaptakiPara() {return hesaptakiPara;} static int boyut() {return 72;}

10.4.1 Kayit.java dosyası
import import import import

java.io.*; java.awt.*; java.awt.event.*; Kayit;

public class RaslantisalUlasimDosyasiYarat { private Kayit hesapDosyasi; private RandomAccessFile girdi; public RaslantisalUlasimDosyasiYarat() { hesapDosyasi = new Kayit();

va
196

public void yaz(RandomAccessFile dosya) throws IOException { StringBuffer buf; dosya.writeInt(hesap); if(Isim!=null) buf=new StringBuffer(Isim); else buf=new StringBuffer(15); buf.setLength(15); dosya.writeChars(buf.toString()); if(soyIsim!=null) buf=new StringBuffer(soyIsim); else buf=new StringBuffer(15); buf.setLength(15); dosya.writeChars(buf.toString()); dosya.writeDouble(hesaptakiPara); }

dil

i.c o

private double hesaptakiPara; public void oku(RandomAccessFile dosya) throws IOException { //RandomAccessFile = Raslantisal Ulasim dosyasi hesap=dosya.readInt(); char first[]=new char[15]; for(int i=0;i<first.length;i++) { first[i]=dosya.readChar(); } Isim=new String(first); char last[]=new char[15]; for(int i=0;i<first.length;i++) { last[i]=dosya.readChar(); } soyIsim=new String(last); hesaptakiPara=dosya.readDouble(); }

m

197

}

public static void main(String args[]) { RaslantisalUlasimDosyasiYarat H= new RaslantisalUlasimDosyasiYarat(); }

10.4.2 RaslantisalUlasimDosyasiYarat.java dosyası
import import import import java.io.*; java.awt.*; java.awt.event.*; Kayit;

ww w. ja

public class RaslantisalUlasimDosyasiYaz extends Frame implements ActionListener { private TextField hesapAlani,isimAlani,soyisimAlani,hesaptakiParaAlani; private Button birsonraki,kapat; private RandomAccessFile girdi; private Kayit hesapDosyasi; public RaslantisalUlasimDosyasiYaz() { super("Tesadufi ulasim dosyasina yaz"); hesapDosyasi=new Kayit(); try{ girdi=new RandomAccessFile("musteri1.dat","rw"); } catch(IOException e) { System.err.println("Dosya acma hatasi\n"+e.toString()); System.exit(1); } setSize(300,150); setLayout(new GridLayout(5,2)); add(new Label("Hesap numarasi:")); hesapAlani=new TextField(); add(hesapAlani); add(new Label("isim : ")); isimAlani=new TextField(20); add(isimAlani); add(new Label("Soyisim : ")); soyisimAlani=new TextField(20); add(soyisimAlani); add(new Label("Hesaptaki para : ")); hesaptakiParaAlani=new TextField(20); add(hesaptakiParaAlani); birsonraki=new Button("Gir"); birsonraki.addActionListener(this); add(birsonraki);

va
197

dil

i.c o

try{ girdi = new RandomAccessFile("musteri1.dat","rw"); for(int i=0;i<100;i++) { hesapDosyasi.yaz(girdi); } } catch(IOException e) { System.err.println("Dosya acma hatasi\n"+e.toString()); System.exit(1); } }

m

198

}

ww w. ja
}

public void addKayit() { int accountNumber=0; Double d; if(!hesapAlani.getText().equals("")) { try{ accountNumber=Integer.parseInt(hesapAlani.getText()); if(accountNumber>0 && accountNumber <=100) { hesapDosyasi.yazhesap(accountNumber); hesapDosyasi.yazIsim(isimAlani.getText()); hesapDosyasi.yazsoyIsim(soyisimAlani.getText()); d=new Double(hesaptakiParaAlani.getText()); hesapDosyasi.yazhesaptakiPara(d.doubleValue()); girdi.seek((long)(accountNumber-1)*Kayit.boyut()); hesapDosyasi.yaz(girdi); } hesapAlani.setText(""); isimAlani.setText(""); soyisimAlani.setText(""); hesaptakiParaAlani.setText(""); } catch(NumberFormatException nfe) { System.err.println("Hesap numarasi tamsayi degisken olamalidir"); } catch(IOException io) { System.err.println("Dosyaya yazarken hata olustu\n"+io.toString()); System.exit(1); } } } public void actionPerformed(ActionEvent e) { addKayit(); if(e.getSource()==kapat) { try{ girdi.close();} catch(IOException io) { System.err.println("Dosya kapatilamadi\n"+io.toString()); } System.exit(0); } } public static void main(String args[]) { new RaslantisalUlasimDosyasiYaz(); }

va
198

dil

i.c o

m

kapat=new Button("cikis"); kapat.addActionListener(this); add(kapat); setVisible(true);

199

10.4.3 RaslantisalUlasimDosyasiYaz.java dosyası ve Frame çıktısı
import import import import java.io.*; java.awt.*; java.awt.event.*; Kayit;

ww w. ja

public class RaslantisalUlasimDosyasiOku extends Frame implements ActionListener { private TextField hesapAlani,isimAlani,soyisimAlani,hesaptakiParaAlani; private Button birsonraki,kapat; private RandomAccessFile girdi; private Kayit hesapDosyasi; public RaslantisalUlasimDosyasiOku() { super("Musteri dosyasini oku"); try{ girdi=new RandomAccessFile("musteri1.dat","r"); } catch(IOException e) { System.err.println("Dosya acilamadi\n"+e.toString()); System.exit(1); } hesapDosyasi=new Kayit(); setSize(300,150); setLayout(new GridLayout(5,2)); add(new Label("Hesap numarasi :")); hesapAlani=new TextField(); add(hesapAlani); add(new Label("isim : ")); isimAlani=new TextField(20); add(isimAlani); add(new Label("soyisim : ")); soyisimAlani=new TextField(20); add(soyisimAlani); add(new Label("Hesaptaki para : ")); hesaptakiParaAlani=new TextField(20); add(hesaptakiParaAlani); birsonraki=new Button("bir sonraki hesap"); birsonraki.addActionListener(this);

va
199

dil

i.c o

m

200

}

ww w. ja

public void actionPerformed(ActionEvent e) { if(e.getSource()==birsonraki) okuKayit(); else closeFile(); }

private void closeFile() { try{ girdi.close(); System.exit(0); } catch(IOException e) { System.err.println("Error closing filr\n"+e.toString()); System.exit(1); } } public static void main(String args[]) { new RaslantisalUlasimDosyasiOku(); }

va
200

hesaptakiParaAlani.setText(String.valueOf(hesapDosyasi.okuhesaptakiPara())) ; } catch(EOFException eof) { closeFile(); } catch(IOException io) { System.err.println("Dosyay okurken hata olustu\n"+io.toString()); System.exit(1); } } }

dil

i.c o

public void okuKayit() { int hesap; String ilk,son; double balance; { try{ do{ hesapDosyasi.oku(girdi); } while(hesapDosyasi.okuhesap()==0); hesapAlani.setText(String.valueOf(hesapDosyasi.okuhesap())); isimAlani.setText(String.valueOf(hesapDosyasi.okuIsim())); soyisimAlani.setText(String.valueOf(hesapDosyasi.okusoyIsim()));

m

add(birsonraki); kapat=new Button("cikis"); kapat.addActionListener(this); add(kapat); setVisible(true);

201

}

10.4.4 RaslantisalUlasimDosyasiOku.java dosyası ve Frame çıktısı

ww w. ja
201

va

dil

Yukardaki proğramın ilginç bir yönü de Applet yerine Frame sınıfını kullanmış olmasıdır. Frame sadece yerel bilgisayarda kullanılabilen grafik ortamı programlamasıdır. Temel olarak applet yapılarında kullanılan her yapı Frame de de kullanılabilir. Yalnız frame main programdan başlatılır. Html dosyasından başlatılmaz. Sadece yerel bilgisayarda geçerli bir programlama türüdür.

i.c o

m

202

11.1 Vector Sınıfı

Örneğin double b[]=new double[3]; Deyimi bilgisayar belleğinde 1023400 1023464 1023528 yerlerini birbirini izleyen adreslerde ayırır.

Buradaki sorun eğer bilgisayar belleğindeki toplam yer değiştirilmek istenirse bunun zor olmasıdır. Pratik olarak yapılabilecek şey yeni bir boyutlu değişken oluşturup adresleri değiştirmektir. double c[]=new double[5]; for(int i=0,i<b.length;i++) { c[i]=b[i];} b=c;

Daha gelişmiş bir bilgi yapısı olarak vector sınıfı kullanılır. Vector sınıfında her bilgi elemanı aynı zamanda bir sonraki bilgi elemanının adresini taşır. Boylece istenildiğinde dizinin son elemanına yeni bir adres ilave edilerek kolayca yeni elemanlar ilave edilebilir.

ww w. ja
Vector sınıfında tanımlanan metodlar addElement(Object) capacity() vectörn toplam kapasitesini verir. clone()

Dizinin arasından herhangibir elemanı da kalaylıkla sadece referans adresini değiştirerek silebiliriz.

Vectöre object türü (herhangi bir sınıf olabilir, vectörün hepsi bu sınfta tanımlanmış olmalıdır.) bir eleman ekler.

va
202

dil

i.c o
b[0] b[1] b[2]

Daha önce boyutlu değişkenleri görmüştük. Boyutlu değişkenlerin boyutları bilgisayar belleğinde oluşturulurken birbiri ardına sırayla oluşturulur.

m

11 GELİŞMİŞ JAVA BİLGİ İŞLEME YAPILARI

203

vectorun bir kopye vectörünü verir. contains(Object)

Vectörün içinde sorgulanan elemanın olup olmadığını kontrol eder. copyInto(Object[]) vectorü boyutlu değişkene aktarır. elementAt(int indeks) Verilen indeksteki elemanı verir.. elements() Tüm vektörü enumeration sınıfına aktarır. ensureCapacity(int yeni_kapasite)

eğer yeni_kapasite vector kapasitesinin üstündeyse vector yeni_kapasite’ye aktarılır. firstElement() Vectörün ilk elemanını verir. indexOf(Object)

Object’in indeks değerini verir indexOf(Object, int indeks)

ww w. ja
insertElementAt(Object, int indeks) Vectörün ideks noktasına Object ilave edilir. isEmpty() Vectörün boş olup olmadığı kontrol edilir. lastElement() vectörün son elemanının indeksini verir. lastIndexOf(Object)

Object’in indeks değerini verir, arama indeks değişkeninden başlayarak yapılır.

Object’in vectördeki son tekrarının indeksini verir.

va
203

dil

i.c o

m

204

lastIndexOf(Object, int indeks) indeks ten başlayarak geriye doğru Objectin ilk tekrarlandığı yeri bulur. removeAllElements() Vectördeki bütün elemanları siler. removeElement(Object) Vectördeki Object elemanını siler. removeElementAt(int indeks) indeksle verilen elemanı siler. setElementAt(Object, int indeks) Objectin ideksini indeks olarak belirler. setSize(int) Sets the size of this vector. size()

Vectördeki toplam eleman sayısını verir. toString()

ww w. ja
trimToSize()

Vectörün String eşitini verir.

Vectörün boyutunu dolu olan elemanlarının boyutuna kısaltır.

Aşağıda bu metodların önemlilerinden bazılarını veren bir program verilmiştir.
import java.util.*;import java.awt.*;import java.applet.Applet;import java.awt.event.*;public class VectorTesti extends Applet implements ActionListener{ private Vector v; private Label prompt; private TextField input; private Button addBtn, removeBtn, firstBtn, lastBtn, emptyBtn, containsBtn, locationBtn, trimBtn, statsBtn, displayBtn; Panel YaziPaneli; public void init() { setBackground(Color.lightGray); YaziPaneli=new Panel(); YaziPaneli.setFont(new Font("Serif",Font.BOLD,12)); YaziPaneli.setLayout( new GridLayout(5,2) ); v = new Vector(1);

va
204

dil

i.c o

m

205

}

ww w. ja

public void actionPerformed(ActionEvent e) { if(e.getSource()==addBtn) { v.addElement(input.getText()); showStatus("Listenin sonuna eklendi: "+input.getText()); } else if(e.getSource()==removeBtn) { if(v.removeElement(input.getText())) showStatus("Silindi :"+input.getText()); else showStatus(input.getText()+"not in vector"); } else if(e.getSource() == firstBtn) { try{ showStatus("Ilk eleman : "+v.firstElement()); } catch(NoSuchElementException exception) { showStatus(exception.toString() ); } } else if(e.getSource()==lastBtn) { try{ showStatus("Son eleman : "+v.lastElement());

va
205

prompt= new Label("Bir String degiskeni giriniz "); input = new TextField(10); addBtn = new Button("Ekle"); removeBtn = new Button("Cikar"); firstBtn = new Button("Ilk"); lastBtn = new Button("Son"); emptyBtn = new Button("Bos mu ?"); containsBtn = new Button("Listede varmi?"); locationBtn = new Button("Adresi"); trimBtn = new Button("Kes"); statsBtn = new Button("Istatistikler"); displayBtn = new Button("Listeyi Goster"); add(prompt); add(input); addBtn.addActionListener(this); YaziPaneli.add(addBtn); removeBtn.addActionListener(this); YaziPaneli.add(removeBtn); firstBtn.addActionListener(this); YaziPaneli.add(firstBtn); lastBtn.addActionListener(this); YaziPaneli.add(lastBtn); emptyBtn.addActionListener(this); YaziPaneli.add(emptyBtn); containsBtn.addActionListener(this); YaziPaneli.add(containsBtn); locationBtn.addActionListener(this); YaziPaneli.add(locationBtn); trimBtn.addActionListener(this); YaziPaneli.add(trimBtn); statsBtn.addActionListener(this); YaziPaneli.add(statsBtn); displayBtn.addActionListener(this); YaziPaneli.add(displayBtn); add(YaziPaneli);

dil

i.c o

m

206

ww w. ja

} else if(e.getSource()==locationBtn) { showStatus("Eleman "+v.indexOf(input.getText() )+" pozisyonunda bulundu"); } else if(e.getSource()==trimBtn) { v.trimToSize(); showStatus("Vector boyu eleman boyuna k salt ld "); } else if(e.getSource()== statsBtn) { showStatus("Boyut = "+v.size()+"; Toplam kapasite = "+v.capacity()); } else if(e.getSource()== displayBtn) { Enumeration enum=v.elements(); StringBuffer buf = new StringBuffer(); while(enum.hasMoreElements()) { buf.append(enum.nextElement() ); buf.append(" "); } showStatus(buf.toString() ); } input.setText(""); } }

if(v.contains(searchKey) ) showStatus("Vektor elemanlari " +searchKey); else showStatus("Aranan eleman Vektorde bulunamadi "+searchKey);

va
206

dil

i.c o

} else if(e.getSource() == emptyBtn) { showStatus(v.isEmpty()? "Vector bos ":"vector dolu "); } else if(e.getSource()==containsBtn) { String searchKey = input.getText();

m

} catch(NoSuchElementException exception) { showStatus(exception.toString() );}

207

Şekil 11.1.1 VectorTesti.java programı ve applet çıktısı

ww w. ja

kod parçacığında vector sınıfının elements metodu,Enumeration sınıfı ve Enumeration sınıfının hasMoreElements ve nextElement metodları kullanılarak nasıl döngü oluşturulduğu görülmektedir. Enumeration sınıfı vectör elemanlarını sırayla çağırmaya yarayan özel bir sınıftır.
// Bu program vector ve Enumeration siniflarını// Kullanmaktadır. Bilesim, kesisim kümelerini hesaplar// Ayni zamanda StringTokaniser sınıfını kullanır. import java.util.*; import java.awt.*; import java.applet.Applet; import java.awt.event.*; class SetA { public Vector bilesim(Vector list1, Vector list2) { Vector bilesimVectoru = new Vector(); String s1,s2; Enumeration n1=list1.elements(); Enumeration n2=list2.elements(); while(n1.hasMoreElements()) { s1=(String)n1.nextElement(); bilesimVectoru.addElement(s1); }

va
207

Enumeration n1=list1.elements(); Enumeration n2=list2.elements(); while(n1.hasMoreElements()) { s1=(String)n1.nextElement(); bilesimVectoru.addElement(s1); }

dil

Bundan sonraki program iki kümenin bileşim ve kesişim kümelerini hesaplamaktadır. Kümelerin kaç elemandan oluştuğu tanımlanmamıştır. İşlemler vector sınıfını kullanarak yapılmaktadır. Ayrıca bu yapıda vector sınıfını bir döngü içinde kullanmak için vector sınıfı Enumeration sınıfına yüklenmektedir.

i.c o

m

208

} public Vector kesisim(Vector list1,Vector list2) { Vector kesisimVectoru = new Vector(); String s; Enumeration n = list1.elements(); while(n.hasMoreElements()) { s=(String)n.nextElement(); if(list2.contains(s)) kesisimVectoru.addElement(s); } return kesisimVectoru; }

}

// //

dinamik boyutlu degisken sinifi Vector'u kullanarak iki vector listesi yarat Vector list1 = new Vector(); Vector list2 = new Vector(); Sonuclari yine vektor cinsinden de§iskenler kullanarak aktar Vector ansUn; Vector ansInt; public P1 T1 P2 T2

ww w. ja
//Sonuclarin yazildigi yazi alanini ac cikti = new TextArea(10,40); cikti.setEditable(false); cikti.setText(""); add(P1); add(T1); T1.addActionListener(this); add(P2); add(T2); T2.addActionListener(this); add(cikti); }

// //

void init() { = new Label("Birinci listeyi gir : "); = new TextField(50); = new Label("Ikinci listeyi gir : "); = new TextField(50);

public void girdiA(String string, Vector list)

va
208

public class SetTest extends Applet implements ActionListener { SetA set = new SetA(); // SetA Label L1, P1, P2; TextField T1,T2; TextArea cikti;

dil

i.c o

m

while(n2.hasMoreElements()) { s2=(String)n2.nextElement(); if(!bilesimVectoru.contains(s2)) bilesimVectoru.addElement(s2); } return bilesimVectoru;

209

{

}

public void ciktiA(Vector v) { Enumeration enum = v.elements(); while(enum.hasMoreElements()) { String ans = (String)enum.nextElement(); cikti.append(ans + "\n"); } }

// //

ww w. ja
}

public void actionPerformed(ActionEvent e) { if(e.getSource()==T1) { String stringToTokenize = T1.getText(); girdiA(stringToTokenize,list1); } else if(e.getSource()==T2) { String stringToTokenize = T2.getText(); girdiA(stringToTokenize,list2); Iki listenin bilesim ve kesisim k melerini hesapla. ansUn = set.bilesim(list1,list2); ansInt = set.kesisim(list1,list2); sonuclari cikti alanina gonder cikti.append("\nIki listenin bilesim kumesi : \n"); ciktiA(ansUn); cikti.append("\nIki listenin kesisim kumesi : \n"); ciktiA(ansInt); } } //actionPerformed metodunun sonu

Bu programda aynı zamanda StringTokaniser sınıfı kullanılmıştır. StringTokaniser String değişkenini bosluk kullanarak alt değişkenlere ayırmaya yarayan Enumeration türü bir sınıftır.

va
209

dil

i.c o

// StringTokeniser sinifi String degiskenleri icin // Enumeration sinifinin yaptigina paralel gorev // gorur String'i sıraya sokarak degerlerini sırayla verir StringTokenizer tokens = new StringTokenizer(string); while(tokens.hasMoreTokens()) { String test = tokens.nextToken(); list.addElement(test); }

m

210

Şekil 11.1.2 Vector sınıfını kullanarak iki kumenin bileşim ve kesişim kümelerini hesaplayan SetTest.java programı ve applet çıktısı

JAVA PROGRAMLAMA DİLİ

HAFTA 14 Hafta 13 dosyaları :
ORTAKH~1 ORTAKH~2 ORTAKH~3 ORTAKH~4 JAV JAV JAV JAV

ww w. ja
Bu haftaki dosyalar SAAT~1 JAV SETTES~3 JAV VECTOR~1 JAV ALISTIRMA 1 991 3.730 4.456 28/07/98 27/07/98 27/07/98 ALIŞTIRMA 2

Hafta 13 dosyaları ve saat.java programını inceleyiniz. Saat.java runnable interface’i ile yazılmıştır (implements Runnable). Aynı programın abstract Tread ile (extends Threat) yazılmış şeklini oluşturunuz. Saati gösteren bu programın niçin threat olarak yazılması gerektiğini izah ediniz.

SetTest.java programını inceleyiniz. Kesişim kumesiyle bileşim kumesinin farkını oluşturan kümeyi hesaplayan bir metod yazınız ve test programına da ekleyerek çalıştırınız.

va
1.787 1.668 3.792 2.335 21/07/98 21/07/98 21/07/98 21/07/98 6:40 6:37 7:06 7:09 210

dil

5:47 saat.java 17:55 SetTest.java 16:56 VectorTesti.java

i.c o
OrtakHucreR.java OrtakHucre.java OrtakHucreBuf.java OrtakHucreSyn.java

m

211

12 ÖRNEKLERLE SAYISAL ANALİZ
Bu bölümümüzde bazı pratik matematik problemlerinin java ile nasıl çözülebileceğine göz atacağız. Sayısal analiz işlemlerini yapmak amacıyla iki sınıf oluşturduk bunlar Matrix ve Numeric sınıflarıdır. Bu serinin devamı olan java ile numerik analiz kitabında bu sınıflardaki metotları tek tek inceleyeceğiz. Burada ise sadece program listeleri ve örnek problemler vermekle yetineceğiz. İlkönce Matrix sınıfının metot başlıklarını verelim :

ww w. ja

toString Metotları public static String toString(double left) public static String toString(double[][] left) public static String toString(complex[][] left) public static String toStringT(complex[] left) public static String toString(complex[] left) public static String toStringT(double[] left) public static String toString(double[] left) inverse matris ve denklem sistemi çözüm hesapları public static double[][] inv(double[][] a) public static double[][] inverse(double a[][]) public static double[] LUaxb(double a[][],double x[],int indx[]) public static double[] AXB(double a[][],double b[]) Determinant hesapları public static double det(double a[][]) public static double determinant(double a[][]) public static double D(double a[][]) Matrislerin dört işlemi public static double[][] multiply(double[][] left,double[][] right) public static double[] multiply(double[][] left,double[] right) public static double[] multiply(double[] left,double[][] right) public static double[][] multiply(double left,double[][] right) public static double[][] multiply(double[][] left,double right) public static double[] multiply(double left,double[] right) public static double[] multiply(double[] left,double right) public static double[][] add(double[][] left,double[][] right) public static double[] add(double[] left,double[] right) public static double[][] substract(double[][] left,double[][] right) public static double[] substract(double[] left,double[] right) public static double[][] divide(double[][] left,double[][] right) public static double[][] LUdivide(double[][] left,double[][] right) public static double[] LUdivide(double[] left,double[][] right) public static double[] divide(double[] left,double[][] right) public static double[] divide(double[] left,double[][] right) Üst işlemi public static double[][] pow(double[][] right,double left) public static double[] pow(double[] right,double left) Absulute matriks public static double abs(double[][] left) public static double abs(double[] left)

va
211

dil

i.c o

m

212

Matrix Sınıfının Listesi :

ww w. ja

public class Matrix { // This class defines matrix and vector // calculation methods

public static String toString(double left) { //arrange double to string conversion so that all the //matrix double variables nicely printed in the same column String s=""; if(left>=0) s=s+" "; s=s+left; double n=s.length(); while(n<13) { s=s+" "; n=s.length(); } return s; } public static String toString(double[][] left) { //return a string representation of a matrix int n,m;

va
212

//============================================================= // Numerical Analysis Packages in Java // Matrix calculations class Matrix // Author : Dr. Turhan Coban //============================================================= //Turhan Coban import java.io.*; import complex;

dil

Transpose matriks public static double[][] Transpose(double [][] left) public static double[][] T(double [][] left) public static complex[][] T(complex [][] left) Birim matris public static double[][] I(int n) public static double[] one(int n) EigenValue Poblemi public static double[][] balance(double b[][]) public static double[][] Hessenberg(double b[][]) public static double[][] QR(double b[][]) public static double[][] eigenValue(double b[][]) public static complex[] eigenValueC(double b[][]) public static double[][] balancedEigenValue(double b[][]) public static double[][] eigenQL(double a[][]) Polinomun kökleri public static double[][] poly_roots(double c[]) public static complex[] poly_rootsC(double c[])

i.c o

m

213

ww w. ja

public static String toStringT(complex[] left) { // returns a horizontal string representation of // a complex vector int n,m; String b; b=""; n=left.length; for(int i=0;i<n;i++) { b=b+left[i].toString()+"\n"; } return b; } public static String toString(complex[] left) { // returns a vertical string representation of // a complex vector int n,m; String b; b=""; n=left.length; for(int i=0;i<n;i++) { b=b+left[i].toString()+" "; }

va
213

public static String toString(complex[][] left) { //return a string representation of a complex matrix int n,m; String b; b=""; n=left.length; m=left[0].length; for(int i=0;i<n;i++) { for(int j=0;j<m;j++) { b=b+left[i][j].toString()+"\t"; } b=b+"\n"; } return b; }

dil

i.c o

String b; b=""; n=left.length; m=left[0].length; for(int i=0;i<n;i++) { for(int j=0;j<m;j++) { b=b+toString(left[i][j]); } b=b+"\n"; } return b; }

m

214

ww w. ja

public static String toString(double[] left) { // returns a horizontal string representation // of a double vector int n,m; String b; b=""; n=left.length; for(int i=0;i<n;i++) { b=b+toString(left[i]); } b=b+"\n"; return b; } public static String toString(int[] left) { // returns a horizontal string representation // of a integer vector int n,m; String b; b=""; n=left.length; for(int i=0;i<n;i++) { b=b+left[i]+"\t"; } b=b+"\n"; return b; }

public static double SIGN(double a,double b) { //returns the value of double a with sign of double b; //if a=-2, b= 3 SIGN(a,b) returns 2 //if a=-2, b=-3 SIGN(a,b) returns -2 //if a= 2, b=-3 SIGN(a,b) returns -2 //if a= 2, b= 3 SIGN(a,b) returns 2 if(b!=0) return Math.abs(a)*b/Math.abs(b); else return Math.abs(a);

va
214

dil

i.c o

public static String toStringT(double[] left) { // returns a vertical string representation // of a double vector int n,m; String b; b=""; n=left.length; for(int i=0;i<n;i++) { b=b+toString(left[i])+"\n"; } return b; }

m

b=b+"\n"; return b; }

215

} public static double[][] inv(double[][] a) { // INVERSION OF A MATRIX // inversion by using gaussian elimination // with full pivoting int n=a.length; int m=a[0].length; double b[][]; b=new double[n][n]; int indxc[]; int indxr[]; double ipiv[]; indxc=new int[n]; indxr=new int[n]; ipiv=new double[n]; int i,j,k,l,ll,ii,jj; int icol=0; int irow=0; double big,dum,pivinv,temp; if(n!=m) { System.out.println("Matrix must be square "); for(ii=0;ii<n;ii++) for(jj=0;jj<n;jj++) b[ii][jj]=0.0; return b; } for(i=0;i<n;i++) for(j=0;j<n;j++) b[i][j]=a[i][j]; for(i=0;i<n;i++) { big=0.0; for(j=0;j<n;j++) { if(ipiv[j] != 1) for(k=0;k<n;k++) { if(ipiv[k] == 0) { if(Math.abs(b[j][k]) >= big) { big=Math.abs(b[j][k]); irow=j; icol=k; } } else if(ipiv[k] > 1 ) { System.out.println("error : inverse of the matrix : singular matrix-1"); for(ii=0;ii<n;ii++) for(jj=0;jj<n;jj++) b[ii][jj]=0.0; return b; } } }

ww w. ja

va
215

dil

i.c o

m

216

ww w. ja

++ ipiv[icol]; if(irow != icol) for(l=0;l<n;l++) { temp=b[irow][l]; b[irow][l]=b[icol][l]; b[icol][l]=temp; } indxr[i]=irow; indxc[i]=icol; if(b[icol][icol] == 0.0) { System.out.println("error : inverse of the matrix : singular matrix2"); for(ii=0;ii<n;ii++) for(jj=0;jj<n;jj++) b[ii][jj]=0.0; return b; } pivinv=1.0/b[icol][icol]; b[icol][icol]=1.0; for(l=0;l<n;l++) b[icol][l] *=pivinv; for(ll=0;ll<n;ll++) if(ll != icol) { dum=b[ll][icol]; b[ll][icol]=0.0; for(l=0;l<n;l++) b[ll][l]-= b[icol][l]*dum; } } for(l=n-1;l>=0;l--) { if(indxr[l] != indxc[l]) for(k=0;k<n;k++) { temp=b[k][indxc[l]]; b[k][indxc[l]]=b[k][indxr[l]]; b[k][indxr[l]]=temp; } } return b; } public static double[][] inverse(double a[][]) { //inverse of a matrix //this method enable usage of inv or inverse as //name of mtrix inversion method return Matrix.inv(a); } //LU decomposition method public static double[][] LU(double c[][],int indx[],int d[]) { //returns LU decomposition of matrix c and index indx double a[][]; int n=c.length; a=new double[n][n]; double vv[]; vv=new double[n]; double sum,dum,big,temp;

va
216

dil

i.c o

m

217

ww w. ja

int i,j,k; int imax; int nmax=100; double tiny=1.0e-40; imax=0; for(i=1;i<=n;i++) { for(j=1;j<=n;j++) a[i-1][j-1]=c[i-1][j-1]; } d[0]=1; for(i=1;i<=n;i++) { big=0.0; for(j=1;j<=n;j++) { if(Math.abs(a[i-1][j-1])>big) big=Math.abs(a[i-1][j-1]); } if(big==0) {System.out.println("singular matrix");return a;} vv[i-1]=1.0/big; } for(j=1;j<=n;j++) { for(i=1;i<j;i++) { sum=a[i-1][j-1]; for(k=1;k<i;k++) { sum-=a[i-1][k-1]*a[k-1][j-1]; } a[i-1][j-1]=sum; } big=0; for(i=j;i<=n;i++) { sum=a[i-1][j-1]; for(k=1;k<j;k++) { sum-=a[i-1][k-1]*a[k-1][j-1]; } a[i-1][j-1]=sum; dum=vv[i-1]*Math.abs(sum); if(dum>=big) { imax=i; big=dum; } } //end of i=0 if(j != imax) { for(k=1;k<=n;k++) { dum=a[imax-1][k-1]; a[imax-1][k-1]=a[j-1][k-1]; a[j-1][k-1]=dum; } d[0]=-d[0]; vv[imax-1]=vv[j-1]; } //end of if indx[j-1]=imax; if(a[j-1][j-1]==0) a[j-1][j-1]=tiny;

va
217

dil

i.c o

m

218

ww w. ja

public static double[] LUaxb(double a[][],double x[],int indx[]) { //solves AX=B system of linear equation of LU decomposed matrix a //(calculated by method LU) int ii=0; int i,j,ll=0; double sum=0; int n=a.length; double b[]; b=new double[n]; for(i=1;i<=n;i++) { b[i-1]=x[i-1]; } for(i=1;i<=n;i++) { ll=indx[i-1]; sum=b[ll-1]; b[ll-1]=b[i-1]; if(ii!=0) { for(j=ii;j<=(i-1);j++) { sum-=a[i-1][j-1]*b[j-1]; } } else if(sum!=0) ii=i; b[i-1]=sum; } for(i=n;i>=1;i--) { sum=b[i-1]; if(i<n) { for(j=(i+1);j<=n;j++) { sum-=a[i-1][j-1]*b[j-1]; } } b[i-1]=sum/a[i-1][i-1]; } return b; } public static double[] AXB(double a[][],double b[]) { //Solution of system of linear equations by LU method // note that the same calculation can be done by divide method. int n=a.length; double c[]=new double[n];

va
218

dil

i.c o

if(j!=n) { dum=1.0/a[j-1][j-1]; for(i=j+1;i<=n;i++) a[i-1][j-1]*=dum; }//endif } //end for j= return a; }

m

219

ww w. ja
public static double D(double a[][]) { //determinant of a matrix return Matrix.det(a); }

public static double det(double a[][]) { //determinant of a matrix int n=a.length; int indx[]=new int[n]; int d[]={1}; double e; double b[][]=new double[n][n]; b=Matrix.LU(a,indx,d); e=d[0]; for(int i=0;i<n;i++) e=e*b[i][i]; return e; } //end of det

public static double determinant(double a[][]) { //determinant of a matrix return Matrix.det(a); }

//************* multiply methods definitions ********************* public static double[][] multiply(double[][] left,double[][] right) { //multiplication of two matrices int ii,jj,i,j,k; int m1=left[0].length; int n1=left.length; int m2=right[0].length;

va
219

dil

public static double[][] LUinv(double a[][]) { //inverse of a matrix by using LU decomposition method //this method is more efficient than inv (or inverse) int n=a.length; double c[][]=new double[n][n]; double b[][]=Matrix.I(n); int d[]={0}; int indx[]=new int[n]; double e[][]=new double[n][n]; e=Matrix.LU(a,indx,d); for(int i=0;i<n;i++) { c[i]=Matrix.LUaxb(e,b[i],indx); } return Matrix.T(c); } //end of LUinv

i.c o

m

int d[]={1}; int indx[]=new int[n]; double e[][]=new double[n][n]; e=Matrix.LU(a,indx,d); c=Matrix.LUaxb(e,b,indx); return c; } //end of AXB

220

ww w. ja

public static double[] multiply(double[][] left,double[] right) { //multiplication of one matrix with one vector int ii,jj,i,j,k; int m1=left[0].length; int n1=left.length; int m2=right.length; double[] b; b=new double[m2]; if(n1 != m2) { System.out.println("inner matrix dimensions must agree"); for(ii=0;ii<n1;ii++) { b[ii]=0; } return b; } for(i=0;i<m1;i++) { b[i]=0; for(k=0;k<n1;k++) b[i]+=left[i][k]*right[k]; } return b; //end of multiply of a matrix and a vector } public static double[] multiply(double[] left,double[][] right) { //multiplication of one vector with one matrix int ii,jj,i,j,k; int m2=right[0].length; int n2=right.length; int m1=left.length;

va
220

dil

int n2=right.length; double[][] b; b=new double[m1][n2]; if(n1 != m2) { System.out.println("inner matrix dimensions must agree"); for(ii=0;ii<n1;ii++) { for(jj=0;jj<m2;jj++) b[ii][jj]=0; } return b; } for(i=0;i<m1;i++) { for(j=0;j<n2;j++) { for(k=0;k<n1;k++) b[i][j]+=left[i][k]*right[k][j]; } } return b; //end of multiply of two matrices }

i.c o

m

221

ww w. ja

public static double[][] multiply(double[][] left,double right) { //multiplying a matrix with a constant int i,j; int n=left.length; int m=left[0].length; double b[][]; b=new double[n][m]; for(i=0;i<n;i++) { for(j=0;j<m;j++) b[i][j]=left[i][j]*right; } return b; //end of multiplying a matrix with a constant double } public static double[] multiply(double left,double[] right) { //multiplying a vector with a constant int i; int n=right.length; double b[];

va
221

public static double[][] multiply(double left,double[][] right) { //multiplying a matrix with a constant int i,j; int n=right.length; int m=right[0].length; double b[][]; b=new double[n][m]; for(i=0;i<n;i++) { for(j=0;j<m;j++) b[i][j]=right[i][j]*left; } return b; //end of multiplying a matrix with a constant double }

dil

i.c o

double[] b; b=new double[m1]; if(n2 != m1) { System.out.println("inner matrix dimensions must agree"); for(ii=0;ii<n2;ii++) { b[ii]=0; } return b; } for(i=0;i<m2;i++) { b[i]=0; for(k=0;k<m1;k++) b[i]+=right[i][k]*left[k]; } return b; //end of multiply of a vector and a matrix }

m

222

ww w. ja

public static double[] multiply(double[] left,double right) { //multiplying a vector with a constant int i; int n=left.length; double b[]; b=new double[n]; for(i=0;i<n;i++) { b[i]=right*left[i]; } return b; } //*************** end of multiply methods definitions ************** //=============== defination of power methods pow ============== public static double[][] pow(double[][] right,double left) { // power of a matrix int i,j; double b[][]; int n=right.length; int m=right[0].length; b=new double[n][m]; for(i=0;i<n;i++) { for(j=0;j<m;j++) { if(left==0.0) { b[i][j]=1.0; } else { b[i][j]=Math.pow(right[i][j],left); } } } return b; //end of power of a matrix } public static double[] pow(double[] right,double left) { // power of a vector int i; int n=right.length; double b[]; b=new double[n]; for(i=0;i<n;i++) { if(left==0.0) { b[i]=1.0;

va
222

dil

i.c o

m

b=new double[n]; for(i=0;i<n;i++) { b[i]=left*right[i]; } return b; }

223

//=================end of power method pow definitions ============= //***************** addition add methods ************************** public static double[][] add(double[][] left,double[][] right) { //addition of two matrices int n1=left.length; int m1=left[0].length; int n2=right.length; int m2=right[0].length; int nMax,mMax; int i,j; if(m1>=m2) mMax=m1; else mMax=m2; if(n1>=n2) nMax=n1; else nMax=n2; double b[][]; b=new double[nMax][mMax]; for(i=0;i<n1;i++) { for(j=0;j<m1;j++) { b[i][j]=b[i][j]+left[i][j]; } } for(i=0;i<n2;i++) { for(j=0;j<m2;j++) { b[i][j]=b[i][j]+right[i][j]; } } return b; //end of matrix addition method } public static double[] add(double[] left,double[] right) { //addition of two vectors int n1=left.length; int n2=right.length; int nMax; int i; if(n1>=n2) nMax=n1; else nMax=n2; double b[]; b=new double[nMax]; for(i=0;i<n1;i++) { b[i]=b[i]+left[i]; }

ww w. ja

va
223

dil

i.c o

} return b; //end of power of a vector }

m

} else { b[i]=Math.pow(right[i],left); }

224

ww w. ja

public static double[][] substract(double[][] left,double[][] right) { //addition of two matrices int n1=left.length; int m1=left[0].length; int n2=right.length; int m2=right[0].length; int nMax,mMax; int i,j; if(m1>=m2) mMax=m1; else mMax=m2; if(n1>=n2) nMax=n1; else nMax=n2; double b[][]; b=new double[nMax][mMax]; for(i=0;i<n1;i++) { for(j=0;j<m1;j++) { b[i][j]=b[i][j]+left[i][j]; } } for(i=0;i<n2;i++) { for(j=0;j<m2;j++) { b[i][j]=b[i][j]-right[i][j]; } } return b; //end of matrix substraction method } public static double[] substract(double[] left,double[] right) { //addition of two vectors int n1=left.length; int n2=right.length; int nMax; int i; if(n1>=n2) nMax=n1; else nMax=n2; double b[]; b=new double[nMax]; for(i=0;i<n1;i++) { b[i]=b[i]+left[i]; } for(i=0;i<n2;i++) { b[i]=b[i]-right[i]; } return b;

va
224

dil

i.c o

m

for(i=0;i<n2;i++) { b[i]=b[i]+right[i]; } return b; //end of vector addition method }

225

ww w. ja

public static double[] LUdivide(double[] left,double[][] right) { //division of two matrices utilises AXB (LU decomposition method) //in fact this method is exactly same as AXB except spacing of the //arguments return AXB(right,left); } //============== absolute value of a matrix=================== public static double abs(double[][] left) { // absoulute value of a matrix int i,j; int n=left.length; int m=left[0].length; double b=0; for(i=0;i<n;i++) for(j=0;j<m;j++) { b=b+Math.abs(left[i][j]); } return b;

va
225

public static double[] divide(double[] left,double[][] right) { //division of two matrices int n=right.length; int m=right[0].length; double b[]; b=new double[n]; b=Matrix.multiply(Matrix.inv(right),left); return b; }

dil

public static double[][] LUdivide(double[][] left,double[][] right) { //division of two matrices utilises LUinv method instead of inv int n=right.length; int m=right[0].length; double b[][]; b=new double[n][m]; b=Matrix.multiply(Matrix.LUinv(right),left); return b; }

i.c o

//============== division of the matrices public static double[][] divide(double[][] left,double[][] right) { //division of two matrices int n=right.length; int m=right[0].length; double b[][]; b=new double[n][m]; b=Matrix.multiply(Matrix.inv(right),left); return b; }

m

//end of vector substraction method }

226

} public static double abs(double[] left) { // absolute value of a vector int i; int n=left.length; double b=0; for(i=0;i<n;i++) { b=b+Math.abs(left[i]); } return b; }

ww w. ja

public static double[][] T(double [][] left) { //transpose matrix (if A=a(i,j) T(A)=a(j,i) int i,j; int n=left.length; int m=left[0].length; double b[][]; b=new double[m][n]; for(i=0;i<n;i++) { for(j=0;j<m;j++) { b[j][i]=left[i][j]; } } return b; }

public static complex[][] T(complex [][] left) { //transpose matrix (if A=a(i,j) T(A)=a(j,i) int i,j; int n=left.length; int m=left[0].length; complex b[][]; b=new complex[m][n]; for(i=0;i<n;i++)

va
226

//===============special matrices============================== public static double[][] Transpose(double [][] left) { //transpose matrix (if A=a(i,j) Transpose(A)=a(j,i) int i,j; int n=left.length; int m=left[0].length; double b[][]; b=new double[m][n]; for(i=0;i<n;i++) { for(j=0;j<m;j++) { b[j][i]=left[i][j]; } } return b; }

dil

i.c o

m

227

public static double[][] I(int n) { //unit matrix double b[][]; b=new double[n][n]; for(int i=0;i<n;i++) b[i][i]=1.0; return b; } public static double[] one(int n) { //one matrix double b[]; b=new double[n]; for(int i=0;i<n;i++) b[i]=1.0; return b; }

ww w. ja

public static double[][] characteristic_matrix(double c[]) { //this routine converts polynomial coefficients to a matrix //with the same eigenvalues (roots) int n=c.length-1; int i; double a[][]=new double[n][n]; for(i=0;i<n;i++) { a[0][i]=-c[i+1]/c[0]; } for(i=0;i<n-1;i++) { a[i+1][i]=1; } return a; } //===========Eigen value calculations ============== public static double[][] balance(double b[][]) { // balance of a matrix for more accurate eigenvalue // calculations double radix=2.0; double sqrdx=radix*radix; double c,r,f,s,g; int m,j,i,last; int n=b.length; last=0; double a[][];

va
227

dil

i.c o

m

{ for(j=0;j<m;j++) { b[j][i]=new complex(left[i][j]); } } return b; }

228

ww w. ja

a=new double[n][n]; f=1; s=1; for(i=1;i<=n;i++) for(j=1;j<=n;j++) a[i-1][j-1]=b[i-1][j-1]; while(last==0) { last=1; for(i=1;i<=n;i++) { c=0;r=0; for(j=1;j<=n;j++) { if(j != i) { c+=Math.abs(a[j-1][i-1]); r+=Math.abs(a[i-1][j-1]); } //end of if(j!=.. } //end of for(j=1... if(c != 0 && r != 0 ) { g=r/radix; f=1.0; s=c+r; while(c<g) { f*=radix; c*=sqrdx; } g=r*radix; while(c>g) { f/=radix; c/=sqrdx; } } //end of if(c != 0 && .... if( (c+r)/f < 0.95*s ) { last=0; g=1.0/f; for(j=1;j<=n;j++) { a[i-1][j-1]*=g; } for(j=1;j<=n;j++) { a[j-1][i-1]*=f; } } //end of if( ((c+r.. }//end of for(i=1;i<=n.... } //end of while last==0 return a; }

public static double[][] Hessenberg(double b[][]) { // Calculates the hessenberg matrix // it is used in QR method to calculate eigenvalues // of a matrix(symmetric or non-symmetric) int m,j,i; int n=b.length; double a[][]; a=new double[n][n]; for(i=0;i<n;i++) for(j=0;j<n;j++) a[i][j]=b[i][j];

va
228

dil

i.c o

m

229

ww w. ja

double x,y; if(n>2) { for(m=2;m<=(n-1);m++) { x=0.0; i=m; for(j=m;j<=n;j++) { if(Math.abs(a[j-1][m-2]) > Math.abs(x)) { x=a[j-1][m-2]; i=j; } //end of if(Math.abs(.. }//end of for(j=m,j<=n... if(i!=m) { for(j=(m-1);j<=n;j++) { y=a[i-1][j-1]; a[i-1][j-1]=a[m-1][j-1]; a[m-1][j-1]=y; }//end of for(j=(m-1).. for(j=1;j<=n;j++) { y=a[j-1][i-1]; a[j-1][i-1]=a[j-1][m-1]; a[j-1][m-1]=y; }//end of for(j=1;j<=n.... } //end of if(i!=m) if(x != 0.0) { for(i=(m+1);i<=n;i++) { y=a[i-1][m-2]; if(y!=0.0) { y=y/x; a[i-1][m-2]=y; for(j=m;j<=n;j++) { a[i-1][j-1]-=y*a[m-1][j-1]; } for(j=1;j<=n;j++) { a[j-1][m-1]+=y*a[j-1][i-1]; } }//end of if(y!=0.. }//end of for(i=(m+1)... } //end of if(x != 0.0... }//end of for(m=2;m<=(n-1).. }//end of Hessenberg for(i=1;i<=n;i++) for(j=1;j<=n;j++) { if(i>(j+1)) a[i-1][j-1]=0; } return a; } public static double[][] QR(double b[][])

va
229

dil

i.c o

m

230

ww w. ja

{ //calculates eigenvalues of a Hessenberg matrix int n=b.length; double rm[][]=new double[2][n]; double a[][]=new double[n+1][n+1]; double wr[]=new double[n+1]; double wi[]=new double[n+1]; int nn,m,l,k,j,its,i,mmin; double z,y,x,w,v,u,t,s,r=0,q=0,p=0,anorm; for(i=0;i<n;i++) for(j=0;j<n;j++) a[i+1][j+1]=b[i][j]; anorm=Math.abs(a[1][1]); for (i=2;i<=n;i++) for (j=(i-1);j<=n;j++) anorm += Math.abs(a[i][j]); nn=n; t=0.0; while (nn >= 1) { its=0; do { for (l=nn;l>=2;l--) { s=Math.abs(a[l-1][l-1])+Math.abs(a[l][l]); if (s == 0.0) s=anorm; if ((double)(Math.abs(a[l][l-1]) + s) == s) break; } x=a[nn][nn]; if (l == nn) { wr[nn]=x+t; wi[nn--]=0.0; } else { y=a[nn-1][nn-1]; w=a[nn][nn-1]*a[nn-1][nn]; if (l == (nn-1)) { p=0.5*(y-x); q=p*p+w; z=Math.sqrt(Math.abs(q)); x += t; if (q >= 0.0) { z=p+Matrix.SIGN(z,p); wr[nn-1]=wr[nn]=x+z; if (z!=0) wr[nn]=x-w/z; wi[nn-1]=wi[nn]=0.0; } else { wr[nn-1]=wr[nn]=x+p; wi[nn-1]= -(wi[nn]=z); } nn -= 2; } else { if (its == 30) System.out.println("Too many iterations in hqr"); if (its == 10 || its == 20) { t += x; for (i=1;i<=nn;i++) a[i][i] -= x; s=Math.abs(a[nn][nn-1])+Math.abs(a[nn-1][nn-2]); y=x=0.75*s; w = -0.4375*s*s; }

va
230

dil

i.c o

m

231

ww w. ja

++its; for (m=(nn-2);m>=l;m--) { z=a[m][m]; r=x-z; s=y-z; p=(r*s-w)/a[m+1][m]+a[m][m+1]; q=a[m+1][m+1]-z-r-s; r=a[m+2][m+1]; s=Math.abs(p)+Math.abs(q)+Math.abs(r); p /= s; q /= s; r /= s; if (m == l) break; u=Math.abs(a[m][m-1])*(Math.abs(q)+Math.abs(r)); v=Math.abs(p)*(Math.abs(a[m-1][m-1])+ Math.abs(z)+Math.abs(a[m+1][m+1])); if ((double)(u+v) == v) break; } for (i=m+2;i<=nn;i++) { a[i][i-2]=0.0; if (i != (m+2)) a[i][i-3]=0.0; } for (k=m;k<=nn-1;k++) { if (k != m) { p=a[k][k-1]; q=a[k+1][k-1]; r=0.0; if (k != (nn-1)) r=a[k+2][k-1]; if ((x=Math.abs(p)+Math.abs(q)+Math.abs(r)) != 0.0) { p /= x; q /= x; r /= x; } } if ((s=Matrix.SIGN(Math.sqrt(p*p+q*q+r*r),p)) != 0.0) { if (k == m) { if (l != m) a[k][k-1] = -a[k][k-1]; } else a[k][k-1] = -s*x; p += s; x=p/s; y=q/s; z=r/s; q /= p; r /= p; for (j=k;j<=nn;j++) { p=a[k][j]+q*a[k+1][j]; if (k != (nn-1)) { p += r*a[k+2][j]; a[k+2][j] -= p*z; } a[k+1][j] -= p*y; a[k][j] -= p*x; } mmin = nn<k+3 ? nn : k+3; for (i=l;i<=mmin;i++) { p=x*a[i][k]+y*a[i][k+1]; if (k != (nn-1)) { p += z*a[i][k+2];

va
231

dil

i.c o

m

232

} }

} }

} for(i=0;i<n;i++) { rm[0][i]=wr[i+1]; rm[1][i]=wi[i+1]; } return rm; } //end of QR

ww w. ja

public static complex[] eigenValueC(double b[][]) { // this routine input a matrix (non symetric or symmetric) // and calculate eigen values // method balance can be used prior to this method to balance // the input matrix //output eigenvalues will be in a vector of complex form int n=b.length; double d[][]=new double[2][n]; d=Matrix.QR(Matrix.Hessenberg(b)); complex c[]=new complex[n]; for(int i=0;i<n;i++) { c[i]=new complex(d[0][i],d[1][i]); } return c; } //roots of a polynomial public static double[][] poly_roots(double c[]) { //roots of a degree n polynomial // P(x)=c[n]*x^n+c[n-1]*x^(n-1)+....+c[1]*x+c[0]=0; int n=c.length-1; double a[][]=new double[n][n]; a=characteristic_matrix(c); double d[][]=new double[2][n]; d=eigenValue(a); return d; }

va
232

public static double[][] eigenValue(double b[][]) { // this routine input a matrix (non symetric or symmetric) // and calculate eigen values // method balance can be used prior to this method to balance // the input matrix int n=b.length; double d[][]=new double[2][n]; d=Matrix.QR(Matrix.Hessenberg(b)); return d; }

dil

i.c o

} } while (l < nn-1);

m

a[i][k+2] -= p*r; } a[i][k+1] -= p*q; a[i][k] -= p;

233

ww w. ja

public static double[][] tridiagonal(double b[][], double d[], double e[]) { //reduces matrix to tridiaonal form by using householder transformation //this method is used by QL method to calculate eigen values //and eigen vectors of a symmetric matrix int l,k,j,i; int n=b.length; double scale,hh,h,g,f; double a[][]=new double[n+1][n+1]; double c[][]=new double[n][n]; for(i=0;i<n;i++) for(j=0;j<n;j++) a[i][j]=b[i][j]; for (i=n;i>=2;i--) { l=i-1; h=scale=0.0; if (l > 1) { for (k=1;k<=l;k++) scale += Math.abs(a[i-1][k-1]); if (scale == 0.0) e[i-1]=a[i-1][l-1]; else { for (k=1;k<=l;k++) { a[i-1][k-1] /= scale; h += a[i-1][k-1]*a[i-1][k-1]; } f=a[i-1][l-1]; g=(f >= 0.0 ? -Math.sqrt(h) : Math.sqrt(h)); e[i-1]=scale*g; h -= f*g; a[i-1][l-1]=f-g; f=0.0;

va
233

dil

public static double[][] balancedEigenValue(double b[][]) { // this routine input a matrix (non symetric or symmetric) // and calculates eigen values // method balance is used to balance the matrix previous to // actual calculations int n=b.length; double d[][]=new double[2][n]; d=Matrix.QR(Matrix.Hessenberg(Matrix.balance(b))); return d; }

i.c o

public static complex[] poly_rootsC(double c[]) { // roots of a degree n polynomial // P(x)=c[n]*x^n+c[n-1]*x^(n-1)+....+c[1]*x+c[0]=0; // roots are returned as complex variables int n=c.length-1; double a[][]=new double[n][n]; a=characteristic_matrix(c); double d[][]=new double[2][n]; d=eigenValue(a); complex e[]=new complex[n]; for(int i=0;i<n;i++) e[i]=new complex(d[0][i],d[1][i]); return e; }

m

234

1]);

ww w. ja

} d[1-1]=0.0; e[1-1]=0.0; /* Contents of this loop can be omitted if eigenvectors not wanted except for statement d[i-1]=a[i-1][i-1]; */ for (i=1;i<=n;i++) { l=i-1; if (d[i-1] != 0) { for (j=1;j<=l;j++) { g=0.0; for (k=1;k<=l;k++) g += a[i-1][k-1]*a[k-1][j-1]; for (k=1;k<=l;k++) a[k-1][j-1] -= g*a[k-1][i-1]; } } d[i-1]=a[i-1][i-1]; a[i-1][i-1]=1.0; for (j=1;j<=l;j++) a[j-1][i-1]=a[i-1][j-1]=0.0; } return a; } public static double pythag(double a, double b) { //this method is used by QL method double absa,absb; absa=Math.abs(a); absb=Math.abs(b); if (absa > absb) return absa*Math.sqrt(1.0+(absb/absa)*(absb/absa)); else return (absb==0.0 ? 0.0 : absb*Math.sqrt(1.0+(absa/absb)*(absa/absb))); } public static double[][] QL(double d[], double e[], double a[][]) { // QL algorithm : eigenvalues of a symmetric matrix reduced to tridiagonal // form by using method tridiagonal int n=d.length;

va
234

dil

} } } else e[i-1]=a[i-1][l-1]; d[i-1]=h;

i.c o

for (j=1;j<=l;j++) { a[j-1][i-1]=a[i-1][j-1]/h; g=0.0; for (k=1;k<=j;k++) g += a[j-1][k-1]*a[i-1][k-1]; for (k=j+1;k<=l;k++) g += a[k-1][j-1]*a[i-1][k-1]; e[j-1]=g/h; f += e[j-1]*a[i-1][j-1]; } hh=f/(h+h); for (j=1;j<=l;j++) { f=a[i-1][j-1]; e[j-1]=g=e[j-1]-hh*f; for (k=1;k<=j;k++) a[j-1][k-1] -= (f*e[k-1]+g*a[i-1][k-

m

235

ww w. ja

int m,l,iter,i,j,k; double s,r,p,g,f,dd,c,b; for (i=2;i<=n;i++) e[i-2]=e[i-1]; e[n-1]=0.0; double z[][]=new double[n][n]; for(i=0;i<n;i++) for(j=0;j<n;j++) z[i][j]=a[i][j]; for (l=1;l<=n;l++) { iter=0; do { for (m=l;m<=n-1;m++) { dd=Math.abs(d[m-1])+Math.abs(d[m]); if ((double)(Math.abs(e[m-1])+dd) == dd) break; } if (m != l) { if (iter++ == 30) System.out.println("Too many iterations in QL"); g=(d[l]-d[l-1])/(2.0*e[l-1]); r=Matrix.pythag(g,1.0); g=d[m-1]-d[l-1]+e[l-1]/(g+Matrix.SIGN(r,g)); s=c=1.0; p=0.0; for (i=m-1;i>=l;i--) { f=s*e[i-1]; b=c*e[i-1]; e[i]=(r=Matrix.pythag(f,g)); if (r == 0.0) { d[i] -= p; e[m-1]=0.0; break; } s=f/r; c=g/r; g=d[i ]-p; r=(d[i-1]-g)*s+2.0*c*b; d[i ]=g+(p=s*r); g=c*r-b; for (k=1;k<=n;k++) { f=z[k-1][i ]; z[k-1][i ]=s*z[k-1][i-1]+c*f; z[k-1][i-1]=c*z[k-1][i-1]-s*f; } } if (r == 0.0 && i >= l) continue; d[l-1] -= p; e[l-1]=g; e[m-1]=0.0; } } while (m != l); } return z; } public static double[][] eigenQL(double a[][]) { // QL algoritm to solve eigen value problems // symmetric matrices only (real eigen values) // first column of the matrix returns eigen values // second..n+1 column returns eigen vectors. // Note : If matrix is not symmetric DO NOT use

va
235

dil

i.c o

m

236

//end of eigen value programs //end of class Matrix }

import java.io.*; import Numeric;

ww w. ja

class Matrix3 { public static void main(String args[]) throws IOException { /* double a[][]; a=new double[5][5]; a[0][0]=1; a[0][1]=2; a[0][2]=0; a[0][3]=0; a[0][4]=0; a[1][0]=-2; a[1][1]=3; a[1][2]=0; a[1][3]=0; a[1][4]=0; a[2][0]=3; a[2][1]=4; a[2][2]=50; a[2][3]=0; a[2][4]=0; a[3][0]=-4; a[3][1]=5; a[3][2]=-60; a[3][3]=7; a[3][4]=0; a[4][0]=-5; 236

va

Matrix Sınıfı örnek programları 1. İnverse matris

dil

// this method use eigenValue method (a QR algorithm) int i,j; int n=a.length; double sum[]=new double[n];; double d[]=new double[n]; double b[][]=new double[n][n]; double e[]=new double[n]; double z[][]=new double[n+1][n]; b=tridiagonal(a,d,e); b=QL(d,e,b); for(j=0;j<n;j++) { z[0][j]=d[j]; for(i=0;i<n;i++) { z[i+1][j]=b[i][j]/b[0][j]; if(z[i+1][j]<1e-13) z[i+1][i]=0; } } return z; }

i.c o

m

237

ww w. ja
Solution of system of equation : with second side :

inverse matrix metodları sonucu :
Original Matrix : 1.0 2.0 0.0 0.0 0.0 -2.0 3.0 0.0 0.0 0.0 3.0 4.0 50.0 0.0 0.0 -4.0 5.0 -60.0 7.0 0.0 -5.0 6.0 -70.0 8.0 -9.0 Inverse Matrix : (Method inv) 0.4285714285714286 -0.2857142857142857 0.0 -1.1895246692412392E-17 3.96508223080413E18 0.2857142857142857 0.14285714285714285 0.0 5.947623346206196E-181.9825411154020644E-18 -0.048571428571428564 0.005714285714285717 0.019999999999999997-3.8659551750340293E-19 1.898283117997477E-18 -0.37551020408163255-0.21632653061224483 0.1714285714285714 0.14285714285714282 2.2431036619977644E-17 -0.003628117913832162 0.01723356009070296-0.0031746031746031824 0.126984126984126980.11111111111111112 Matrix * Inverse Matrix : (Method multiply) 1.0 0.0 0.0 0.0 1.5407439555097887E-33 -1.1102230246251565E-16 1.0 0.0 4.163336342344337E-17-1.3877787807814454E-17 4.440892098500626E-16 1.6653345369377348E-16 0.9999999999999999-3.122502256758254E-17 9.887923813067798E-17 0.0 2.220446049250313E-16 0.0 0.9999999999999999 1.7347234759768022E-17 -2.8449465006019636E-16 1.942890293094024E-16 1.734723475976807E-16 0.0 1.0

va
237

a[4][1]=6; a[4][2]=-70; a[4][3]=8; a[4][4]=-9; */ double c[][]=new double[5][5]; double a[][]={{1,2,0,0,0},{-2,3,0,0,0},{3,4,50,0,0},{-4,5,-60,7,0}, {-5,6,-70,8,-9}}; double b[]=new double[5]; int d[]=new int[1]; b[0]=1; b[1]=0; b[2]=0; b[3]=0; b[4]=0; System.out.println("Original Matrix : "); System.out.println(Matrix.toString(a)); System.out.println("Inverse Matrix : (Method inv) "); System.out.println(Matrix.toString(Matrix.inv(a))); System.out.println("Matrix * Inverse Matrix : (Method multiply) "); System.out.println(Matrix.toString(Matrix.multiply(a,Matrix.inv(a)))); System.out.println("Solution of system of equation : "); System.out.println("with second side : "); System.out.println(Matrix.toStringT(b)); System.out.println(Matrix.toString(Matrix.divide(b,a))); int indx[]=new int[5]; d[0]=0; c=Matrix.LU(a,indx,d); System.out.println("LU decomposed matrix : (Method LU) "); System.out.println(Matrix.toString(c)); System.out.println("Matrix inversion by LU decomposition : (Method LUinv)"); System.out.println(Matrix.toString(Matrix.LUinv(a))); System.out.println("Matrix * Inverse Matrix (LU Decomposition) :"); System.out.println(Matrix.toString(Matrix.multiply(a,Matrix.LUinv(a)))); } }

dil

i.c o

m

238

Matrix inversion by LU decomposition : (Method LUinv) 0.42857142857142855-0.2857142857142857 -0.0 -0.0 -0.0 0.2857142857142857 0.14285714285714285 0.0 0.0 0.0 -0.04857142857142856 0.005714285714285712 0.02 -0.0 -0.0 -0.37551020408163255-0.21632653061224494 0.17142857142857143 0.14285714285714285 0.0 -0.0036281179138321806 0.017233560090702916-0.003174603174603183 0.126984126984126980.1111111111111111

dil
238

Matrix * Inverse Matrix (LU Decomposition) : 1.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 4.440892098500626E-16-1.1102230246251565E-16 1.0 0.0 0.0 -4.440892098500626E-16-4.440892098500626E-16 0.0 1.0 0.0 -1.1796119636642288E-16-8.326672684688674E-17-4.5102810375396984E-17 0.0

2.

n inci dereceden polinomun kökleri

ww w. ja

class Matrix4 { public static void main(String args[]) throws IOException { //calculation of the roots of a polynomial (degree n) double a[][]; a=new double[3][3]; /* double e[]=new double[4]; e[0]= -1; e[1]= 8; e[2]=-19; e[3]= 12; */ double e[]={-1,8,-19,12}; //e represents polynomial P(x)=-x^3+8*x^2-19*x+12 // indirect way calculate charecteristic matrix and then calculate // eigenvalue of the characteristic matrix // by using charecteristic_matrix and eigenValue // (or eigenValueC or balancedEigenValue) // C in method names indicated complex variable output System.out.println("Original polynomial : "); System.out.println(Matrix.toString(e)); a=Matrix.characteristic_matrix(e); System.out.println("Characteristic Matrix : "); System.out.println(Matrix.toString(a)); //unbalanced matrix eigenvalue calculations System.out.println("eigen values (Method eigenValue)"); System.out.println(Matrix.toString(Matrix.T(Matrix.eigenValue(a)))); //balanced eigen value calculations

va

import java.io.*; import Numeric;

i.c o
1.0

1.0 0.0 0.0 0.0 0.0 0.4285714285714286 0.2857142857142857 -0.048571428571428564 -0.37551020408163255 -0.003628117913832162 LU decomposed matrix : (Method LU) -2.0 3.0 0.0 0.0 0.0 -0.5 3.5 0.0 0.0 0.0 2.5 -0.42857142857142855-70.0 8.0 -9.0 -1.5 2.4285714285714284-0.7142857142857143 5.714285714285714-6.428571428571429 2.0 -0.2857142857142857 0.8571428571428571 0.025000000000000064 7.875

m

239

System.out.println("eigen values (Method balancedeigenValue)"); System.out.println(Matrix.toString(Matrix.T(Matrix.balancedEigenValue(a)))) ; complex c[]=new complex[5]; c=Matrix.eigenValueC(a); System.out.println("eigen values (Method eigenValueC)"); System.out.println(Matrix.toStringT(c)); //direct way use poly_roots (or poly_rootsC) //poly_roots returns double matrix 2xn as complex value representation //poly_rootsC returns complex vector solution as roots System.out.println("roots of polynomial (Method poly_roots)"); System.out.println(Matrix.toString(Matrix.T(Matrix.poly_roots(e)))); System.out.println("roots of polynomial (Method poly_roots)"); System.out.println(Matrix.toStringT(Matrix.poly_rootsC(e))); } }

cözüm :
Original polynomial : -1.0 8.0 Characteristic Matrix : 8.0 -19.0 1.0 0.0 0.0 1.0 -19.0 12.0 0.0 0.0

ww w. ja
eigen values (Method eigenValueC) 3.9999999999999964 3.0000000000000067 0.9999999999999991 roots of polynomial 3.9999999999999964 3.0000000000000067 0.9999999999999991

eigen values (Method balancedeigenValue) 4.000000000000007 0.0 2.999999999999993 0.0 1.0000000000000004 0.0

(Method poly_roots) 0.0 0.0 0.0

roots of polynomial (Method poly_roots) 3.9999999999999964 3.0000000000000067 0.9999999999999991

3.

Determinant

import java.io.*; import Numeric;

va
239

eigen values (Method eigenValue) 3.9999999999999964 0.0 3.0000000000000067 0.0 0.9999999999999991 0.0

dil
12.0

i.c o

m

240

cözümü :
Matrix : 1.0 3.0 2.0 4.0

Matrix * Inverse Matrix : 1.0 0.0 0.0 1.0 Determinant = -2.0

ww w. ja
import java.io.*; import Numeric;

4.

Eigenvalue

class Matrix6 { public static void main(String args[]) throws IOException { //Eigen Value calculations using QL method double a[][]={{3,-1,0},{-1,2,-1},{-0,-1,3}}; System.out.println("Original Matrix : "); System.out.println(Matrix.toString(a)); System.out.println("eigen values and Eigen Vectors : "); System.out.println(Matrix.toString(Matrix.eigenQL(a))); } }

çözümü :

Original Matrix : 3.0 -1.0 -1.0 2.0

va
0.0 -1.0 240

Inverse Matrix : -2.0 1.0 1.5 -0.5

dil

i.c o

class Matrix5 { public static void main(String args[]) throws IOException { //calculation of an inverse matrix double a[][]; a=new double[2][2]; a[0][0]=1; a[0][1]=2; a[1][0]=3; a[1][1]=4; System.out.println("Matrix : "); System.out.println(Matrix.toString(a)); System.out.println("Inverse Matrix : "); System.out.println(Matrix.toString(Matrix.inv(a))); System.out.println("Matrix * Inverse Matrix :"); System.out.println(Matrix.toString(Matrix.multiply(a,Matrix.inv(a)))); System.out.println("Determinant = "+Matrix.det(a)); } }

m

241

0.0

-1.0

3.0

eigen values and Eigen Vectors : 4.0 2.9999999999999996 1.0000000000000004 1.0 1.0 1.0 -1.0000000000000004 0.0 2.0000000000000004 1.0000000000000007-0.9999999999999997 1.0000000000000004

Numeric sınıfı (Sayısal analiz paketi)

Numerik sınıfı ve fonksiyon girdi sınıfları ve metotları :

ww w. ja
Non-linear denklem kökleri
public public public public public static static static static static double double double double double

// birden fazla fonksiyon birden fazla değişken // tüm fonksiyonların değerini vektör olarak verir // örnek f[0]=x[0]+sin(x[1]) // f[1]=x[0]*x[0]-x[1] // func(x) f[0] ve f[1] değerlerini verir abstract double[] func(double x[]); abstract class fij_xi { // iki boyutlu fonksiyon matrisi ve değişken vectörü verilmiş // örnek f[0][0]=x[0]+Math.sin(x[1]) f[0][1]=x[0]-x[1] // f[1][0]=x[0]*x[0]-x[1] f[1][1]=Math.exp(x[0]+x[1]*x[1] // func(x) f[0][0], f[0][1] // f[1][0], f[1][1] // değerlerin iki boyutlu matrix olarak verir. abstract double[][] func(double x[]); public class Numeric Türev public static double derivative(f_x f_deriv,double x) public static double derivative(f_xi f_deriv,int equation_ref, double x[],int x_ref) public static double derivative(fi_xi f_deriv, int equation_ref,double x[],int x_ref) İntegral public static double integral(f_x f_xnt,double a,double b) public static void trap(f_x ff,double a,double h, int j,int m,double R[][]) public static double integral_romberg(f_x ff,double a,double b) newton(double x,f_x y,f_x dy) newton(double x,f_x y) newton_2nd_derivative(double x,f_x y,f_x dy) newton_2nd_derivative(double x,f_x y) secant_2nd_derivative(double x,f_x y)

va
241

dil

abstract class f_x //tek fonksiyon tek değişken // örnek f=x*x abstract double func(double x); abstract class f_xi // birden fazla fonksiyon birden fazla değişken // denklem_referansı indisinin değerine göre bir fonksiyon gri verir // örnek f[0]=x[0]+sin(x[1]) // f[1]=x[0]*x[0]-x[1] // func(x,1) f[1]değerini verir // func(x,0) f[0]değerini verir abstract double func(double x[],int equation_ref); abstract class fi_xi

i.c o

m

242

Least Square polinom uydurma

Diferansiyel denklemler

public static double[] RK4(f_xi fp,double x0,double xn,double f0,int N) public static double[][] RK4(f_xi fp,double x0,double xn,double f0[],int public static double[][] RKF45(f_xi fp,double x0,double xn,double f0,int N) throws IOException

abstract class f_x { //single function single independent variable // example f=x*x abstract double func(double x); }

ww w. ja
} abstract double[] func(double x[]); }

abstract class f_xi { // multifunction multi independent variable // a single value is returned indiced to equation_ref // example f[0]=x[0]+sin(x[1]) // f[1]=x[0]*x[0]-x[1] // func(x,1) returns the value of f[1] // func(x,0) returns the value of f[0] abstract double func(double x[],int equation_ref);

abstract class fi_xi { // multifunction multi independent variable // vector of dependent variables are returned // example f[0]=x[0]+sin(x[1]) // f[1]=x[0]*x[0]-x[1] // func(x) returns the value of f[0] and f[1] // as a two dimensional vector

va
242

//============================================================= // Numerical Analysis Package in Java // Numerical analysis calculation class Numeric // Author : Dr. Turhan Coban //============================================================= import java.io.*; import Matrix;

dil

Numeric sınıfı listesi :

i.c o

public static double[] poly_least_square (double xi[],double yi[],int n) public static double f_least_square(double e[],double x) public static double error(double x[],double y[],double e[]) public static double[][] orthogonal_polynomial_least_square (double xi[],double fi[],int m) public static double f_orhogonal_polynomial(double a[][],double x)

m

public static double bisection(double xl,double xu,f_x y) public static double[] newton( double x[],fi_xi y,fij_xi dy) public static double[] newton( double x[],fi_xi y)

243

abstract double[][] func(double x[]); }

ww w. ja

public class Numeric { //This is a library of numerical methods // public static double derivative(f_x f_deriv,double x) { // This method calculates derivatives of a simple function // accuracy of method can be adjusted by changing // variables h0 and n // function input should be in the form given in abstract class // f_x double h0=0.0256; int i,m; int n=7; //derivative of a simple function double T[][]; T=new double[n][n]; double h[]; h=new double[n]; //vector<double> h(n,0); for(i=0;i<n;i++) { h[i]=0; for(int j=0;j<n;j++) T[i][j]=0; } h[0]=h0; double r=0.5; for( i=1;i<n;i++) { h[i]=h0*Math.pow(r,i); }

for(i=0;i<n;i++) { T[i][0]=( f_deriv.func(x + h[i]) - f_deriv.func( x - h[i]))/(2.0*h[i]); } for(m=1;m<n;m++) { for(i=0;i<n-m;i++) { T[i][m]=(h[i]*h[i]*T[i+1][m-1] - h[i+m]*h[i+m]*T[i][m-1])/(h[i]*h[i] - h[i+m]*h[i+m]); } }

va
243

dil

i.c o

abstract class fij_xi { // multifunction multi independent variable // for n independent variable n*n matrix of // dependent variables are returned // example f[0][0]=x[0]+Math.sin(x[1]) f[0][1]=x[0]-x[1] // f[1][0]=x[0]*x[0]-x[1] f[1][1]=Math.exp(x[0]+x[1]*x[1] // func(x) returns the value of f[0][0], f[0][1] // f[1][0], f[1][1] // as a two dimensional matrix

m

244

ww w. ja

double h0=0.0256; int i,m; int n=7; double x1[]; x1=new double[x.length]; double x2[]; x2=new double[x.length]; for(i=0;i<x.length;i++) { x1[i]=x[i]; x2[i]=x[i]; } //derivative of a simple function double T[][]; T=new double[n][n]; double h[]; h=new double[n]; //vector<double> h(n,0); for(i=0;i<n;i++) { h[i]=0; for(int j=0;j<n;j++) T[i][j]=0; } h[0]=h0; double r=0.5; for( i=1;i<n;i++) { h[i]=h0*Math.pow(r,i); }

for(i=0;i<n;i++) { x1[x_ref]+=h[i]; x2[x_ref]-=h[i]; T[i][0]=( f_deriv.func(x1,equation_ref) f_deriv.func(x2,equation_ref))/(2.0*h[i]); x1[x_ref]=x[x_ref]; x2[x_ref]=x[x_ref]; } for(m=1;m<n;m++) { for(i=0;i<n-m;i++) { T[i][m]=(h[i]*h[i]*T[i+1][m-1] h[i+m]*h[i+m]*T[i][m-1])/(h[i]*h[i] - h[i+m]*h[i+m]); } }

va
244

dil

i.c o

public static double derivative(f_xi f_deriv,int equation_ref, double x[],int x_ref) { // This method calculates derivative of a function selected from a set of // functions. Accuracy of method can be adjusted by changing // variables h0 and n // function input should be in the form given in abstract class // f_xi

m

double xx=T[0][n-1]; return xx; }

245

ww w. ja

public static double derivative(fi_xi f_deriv, int equation_ref,double x[],int x_ref) { // This method calculates derivative of a function selected from a set of // functions. Accuracy of method can be adjusted by changing // variables h0 and n // function input should be in the form given in abstract class // f_xi double h0=0.0256; int i,m; int n=7; double f1[]; f1=new double[x.length]; double f2[]; f2=new double[x.length]; double x1[]; x1=new double[x.length]; double x2[]; x2=new double[x.length]; for(i=0;i<x.length;i++) { x1[i]=x[i]; x2[i]=x[i]; } //derivative of a simple function double T[][]; T=new double[n][n]; double h[]; h=new double[n]; //vector<double> h(n,0); for(i=0;i<n;i++) { h[i]=0; for(int j=0;j<n;j++) T[i][j]=0; } h[0]=h0; double r=0.5; for( i=1;i<n;i++) { h[i]=h0*Math.pow(r,i); } for(i=0;i<n;i++) { x1[x_ref]+=h[i]; x2[x_ref]-=h[i]; f1=f_deriv.func(x1); f2=f_deriv.func(x2); T[i][0]=( f1[equation_ref] - f2[equation_ref])/(2.0*h[i]); x1[x_ref]=x[x_ref]; x2[x_ref]=x[x_ref]; } for(m=1;m<n;m++) { for(i=0;i<n-m;i++) {

va
245

dil

i.c o

m

double xx=T[0][n-1]; return xx; }

246

} double xx=T[0][n-1]; return xx; }

ww w. ja

public static double integral(f_x f_xnt,double a,double b) { //integral of a function by using gauss-legendre quadrature // double s[],w[]; int i; s=new double[30]; w=new double[30]; s[ 0] = .15532579626752470000E-02; s[ 1] = .81659383601264120000E-02; s[ 2] = .19989067515846230000E-01; s[ 3] = .36899976285362850000E-01; s[ 4] = .58719732103973630000E-01; s[ 5] = .85217118808615820000E-01; s[ 6] = .11611128394758690000E+00; s[ 7] = .15107475260334210000E+00; s[ 8] = .18973690850537860000E+00; s[ 9] = .23168792592899010000E+00; s[10] = .27648311523095540000E+00; s[11] = .32364763723456090000E+00; s[12] = .37268153691605510000E+00; s[13] = .42306504319570830000E+00; s[14] = .47426407872234120000E+00; s[15] = .52573592127765890000E+00; s[16] = .57693495680429170000E+00; s[17] = .62731846308394490000E+00; s[18] = .67635236276543910000E+00; s[19] = .72351688476904450000E+00; s[20] = .76831207407100990000E+00; s[21] = .81026309149462140000E+00; s[22] = .84892524739665800000E+00; s[23] = .88388871605241310000E+00; s[24] = .91478288119138420000E+00; s[25] = .94128026789602640000E+00; s[26] = .96310002371463720000E+00; s[27] = .98001093248415370000E+00; s[28] = .99183406163987350000E+00; s[29] = .99844674203732480000E+00; w[ 0] = .39840962480827790000E-02; w[ 1] = .92332341555455000000E-02; w[ 2] = .14392353941661670000E-01; w[ 3] = .19399596284813530000E-01; w[ 4] = .24201336415292590000E-01; w[ 5] = .28746578108808720000E-01; w[ 6] = .32987114941090080000E-01; w[ 7] = .36877987368852570000E-01; w[ 8] = .40377947614710090000E-01; w[ 9] = .43449893600541500000E-01; w[10] = .46061261118893050000E-01; w[11] = .48184368587322120000E-01; w[12] = .49796710293397640000E-01; w[13] = .50881194874202750000E-01; w[14] = .51426326446779420000E-01;

va
246

dil

i.c o

m

T[i][m]=(h[i]*h[i]*T[i+1][m-1] - h[i+m]*h[i+m]*T[i][m-1])/(h[i]*h[i] - h[i+m]*h[i+m]); }

247

ww w. ja

public static void trap(f_x ff,double a,double h, int j,int m,double R[][]) { // successive trapezoidal integration rule // this program will be utilised in romberg integration double sum=0; int p; for(p=1;p<=m;p++) { sum+=ff.func(a+h*(2*p-1)); } R[j][0]=R[j-1][0]/2.0+h*sum; } public static double integral_romberg(f_x ff,double a,double b) { //romberg integration int n=8;//increase n to increase accuracy double R[][]; R=new double[n+1][n+1]; int m=1; double h=b-a; double close=1; double tol=1e-40; int j=0,k=0; double ret=0; R[0][0]=h/2.0*(ff.func(a)+ff.func(b)); do { j++;

va
247

w[15] = .51426326446779420000E-01; w[16] = .50881194874202750000E-01; w[17] = .49796710293397640000E-01; w[18] = .48184368587322120000E-01; w[19] = .46061261118893050000E-01; w[20] = .43449893600541500000E-01; w[21] = .40377947614710090000E-01; w[22] = .36877987368852570000E-01; w[23] = .32987114941090080000E-01; w[24] = .28746578108808720000E-01; w[25] = .24201336415292590000E-01; w[26] = .19399596284813530000E-01; w[27] = .14392353941661670000E-01; w[28] = .92332341555455000000E-02; w[29] = .39840962480827790000E-02; int n=30; double z=0; double x,y; for(i=0;i<n;i++) { x=(b+a)/2.0+(b-a)/2.0*s[i]; y=f_xnt.func(x); z+=(b-a)/2*w[i]*y; } for(i=0;i<n;i++) { x=(b+a)/2.0+(b-a)/2.0*(-s[i]); y=f_xnt.func(x); z+=(b-a)/2.0*w[i]*y; } return z; }

dil

i.c o

m

248

//================================================== //Finding Non-linear Roots of Functions public static double newton(double x,f_x y,f_x dy) { // Newton - Raphson method for single equation // with single variable // required function and its derivative int nmax=500; double tolerance=1.0e-15; double fx,dfx; for(int i=0;i<nmax;i++) { fx=y.func(x); dfx=dy.func(x); x-=fx/dfx; if(Math.abs(fx)<tolerance) { return x; } } return x; }

ww w. ja
int nmax=500; double tolerance=1.0e-15; double fx,dfx; for(int i=0;i<nmax;i++) { fx=y.func(x); dfx=Numeric.derivative(y,x); x-=fx/dfx; if(Math.abs(fx)<tolerance) { return x; } } return x; }

public static double newton(double x,f_x y) { // Newton - Raphson method for single equation // required function only derivative is calculated // numerically by using method derivative

va
248

dil

i.c o

h/=2.0; Numeric.trap(ff,a,h,j,m,R); m*=2; for(k=1;k<=j;k++) { R[j][k]=R[j][k-1]+(R[j][k-1]-R[j-1][k-1])/(Math.pow(4,k)-1.0); close=Math.abs(R[j-1][j-1]-R[j][j]); ret=R[j][k]; } }while(close>tol && j<n); return ret; }

m

249

ww w. ja

public static double newton_2nd_derivative(double x,f_x y) { // Newton - Raphson type method for single equation // includes 2nd order derivative calculations // function is required, first order derivative calculated // numerically by derivative method. int nmax=500; double dx=1e-3; double x1m; double tolerance=1.0e-15; double fx,fxm,dfx,dfxm,d2fx; for(int i=0;i<nmax;i++) { fx=y.func(x); fxm=y.func(x-dx); dfx=Numeric.derivative(y,x); dfxm=Numeric.derivative(y,(x-dx)); d2fx=-6.0/dx/dx*(fx-fxm)+2.0/dx*(2.0*dfx+dfxm); x-=(fx/dfx+.5*fx*fx/(dfx*dfx*dfx)*d2fx); if(Math.abs(fx)<tolerance) { return x; } } return x; } public static double secant_2nd_derivative(double x,f_x y) { // Newton - Raphson type method for single equation // includes 2nd order derivative calculations // function should be supplied int nmax=500;

va
249

dil

public static double newton_2nd_derivative(double x,f_x y,f_x dy) { // Newton - Raphson type method for single equation // includes 2nd order derivative calculations //function and first order derivative is required int nmax=500; double dx=1e-3; double x1m; double tolerance=1.0e-15; double fx,fxm,dfx,dfxm,d2fx; for(int i=0;i<nmax;i++) { fx=y.func(x); fxm=y.func(x-dx); dfx=dy.func(x); dfxm=dy.func(x-dx); d2fx=-6.0/dx/dx*(fx-fxm)+2.0/dx*(2.0*dfx+dfxm); x-=(fx/dfx+.5*fx*fx/(dfx*dfx*dfx)*d2fx); if(Math.abs(fx)<tolerance) { return x; } } return x; }

i.c o

m

250

ww w. ja

public static double bisection(double xl,double xu,f_x y) { //bisection method to find roots of a function y.func(x) //function should be supplied // defination of variables : // xl : lower guess // xu : upper guess // xr : root estimate // es : stopping criterion // ea :approximate error // maxit : maximum iterations // iter : number of iteration double test; double xr=0; double es,ea; double fxl,fxr; int maxit=500,iter=0; es=0.000001; ea=1.1*es; while((ea>es)&&(iter<maxit)) { xr=(xl+xu)/2.0; iter++; if((xl+xu)!=0) { ea=Math.abs((xu-xl)/(xl+xu))*100;} fxl= y.func(xl); fxr= y.func(xr); test= fxl*fxr; if(test==0.0) ea=0; else if(test<0.0) xu=xr; else { xl=xr; } } //end of while return xr; }

va
250

dil

double dx=1.0e-3; double dx1=2.0e-3; double x1m; double tolerance=1.0e-15; double fx,fxm,fxm1,dfx,dfxm,d2fx; for(int i=0;i<nmax;i++) { fx=y.func(x); fxm=y.func(x-dx); fxm1=y.func(x-dx1); dfx=(fx-fxm)/dx; dfxm=(fx-fxm1)/dx1; d2fx=-6.0/dx/dx*(fx-fxm)+2.0/dx*(2.0*dfx+dfxm); x-=(fx/dfx+.5*fx*fx/(dfx*dfx*dfx)*d2fx); if(Math.abs(fx)<tolerance) { return x; } } return x; }

i.c o

m

251

ww w. ja

public static double[] newton( double x[],fi_xi y) { //solution of nonlinear system of equations //by using newton raphson method. //this function does not require derivatives //it is utilised method derivative to calculate derivatives double ti=1.0; int i,ii,jj; int nmax=400; double tolerance=1.0e-15; int n=x.length; double b[]; b=new double[n]; double dy[][]; dy=new double[n][n]; i=0; for(i=0;i<n;i++) { b[i]=1.0; } while( i++ < nmax && Matrix.abs(b) > tolerance ) { for(ii=0;ii<n;ii++) { for(jj=0;jj<n;jj++) { dy[ii][jj]=Numeric.derivative(y,ii,x,jj); } } b=Matrix.multiply(Matrix.divide(y.func(x),dy),-ti); x=Matrix.add(x,b);

va
251

dil

public static double[] newton( double x[],fi_xi y,fij_xi dy) { //solution of nonlinear system of equations //by using newton raphson method. //ti :weigth factor //x independent value vector: //y dependent function vector //dy derivative of dependent function matrix double ti=1.0; int i; int nmax=400; double tolerance=1.0e-15; int n=x.length; double b[]; b=new double[n]; for(i=0;i<n;i++) { b[i]=1.0; } i=0; while( i++ < nmax && Matrix.abs(b) > tolerance ) { b=Matrix.multiply(Matrix.divide(y.func(x),dy.func(x)),-ti); x=Matrix.add(x,b); } if(i >= nmax) System.out.println("warning maximum number"+ " of iterations results may not be valid"); return x; }

i.c o

m

252

//========= least square curve fitting methods ========== //-------- polynomial least square curve fitting -------public static double[] poly_least_square (double xi[],double yi[],int n) //polynomial least square curve fitting //variables xi,yi vector of data points //degree of curve fitting { //xi vector of independent variable //yi vector of dependent variable //n : degree of curve fitting int l=xi.length; int i,j,k; int np1=n+1; double A[][]; A=new double[np1][np1]; double B[]; B=new double[np1]; double X[]; X=new double[np1];

ww w. ja

for(i=0;i<n+1;i++) { for(j=0;j<n+1;j++) { if(i==0 && j==0) A[i][j]=l; else for(k=0;k<l;k++) A[i][j] += Math.pow(xi[k],(i+j)); } for(k=0;k<l;k++) { if(i==0) B[i]+= yi[k]; else B[i] += Math.pow(xi[k],i)*yi[k]; } } X=Matrix.divide(B,A); //X=B/A;

double max=0; for(i=0;i<n+1;i++) if(Math.abs(X[i]) > max) max = Math.abs(X[i]); for(i=0;i<n+1;i++) if((Math.abs(X[i]/max) > 0) && (Math.abs(X[i]/max) < 1.0e-11)) X[i]=0; return X; } public static double f_least_square(double e[],double x) { // this function calculates the value of

va
252

dil

i.c o

m

} if(i >= nmax) System.out.println("warning maximum number of iterations"+ " results may not be valid" ); return x; }

253

//-------End least square methods -------------------//-------Orthogonal polynomial least square curve fitting --public static double[][] orthogonal_polynomial_least_square (double xi[],double fi[],int m) //orthogonal polynomial least square curve fitting //this method do not require any matrix solution //variables xi,fi vector of data points wi weight functions //m degree of curve fitting { int i,j,k; int n=xi.length; int mp2=n+2; int mp1=n+1; //matrix<double> p(m+2,n,0); double p[][]; p=new double[mp2][n]; //vector<double> gamma(m+1,0); double gamma[]; gamma=new double[mp1]; //vector<double> beta(m+1,0); double beta[]; beta=new double[mp1]; //vector<double> omega(m+1,0); double omega[]; omega=new double[mp1]; //vector<double> alpha(m+1,0); double alpha[]; alpha=new double[mp1]; //vector<double> b(m+1,0); double b[]; b=new double[mp1]; //vector<double> wi(n,1.); double wi[];

ww w. ja

va
253

dil

public static double error(double x[],double y[],double e[]) { //calculates absolute square root error of a least square approach double n=x.length; int k; double total=0; for(k=0;k<n;k++) { total+=(y[k]-f_least_square(e,x[k]))*(y[k]-f_least_square(e,x[k])); } total=Math.sqrt(total); return total; }

i.c o

// least square curve fitting function int n=e.length; double ff; if(n!=0.0) { ff=e[n-1]; for(int i=n-2;i>=0;i--) { ff=ff*x+e[i]; } } else ff=0; return ff; }

m

254

ww w. ja
double yy=0; int k; int m=a[0].length-1; int mp2=m+2; double q[]; q=new double[mp2]; //vector<double> q(m+2,0.0);

wi=new double[n]; //matrix<double> a(3,m+1); double a[][]; a=new double[3][mp1]; for(i=0;i<n;i++) { p[1][i]=1.0; p[0][i]=0.0; } gamma[0]=0; for(i=0;i<n;i++) { gamma[0]+=wi[i]; } beta[0]=0.0; for(j=0;j<m+1;j++) { omega[j]=0; for(i=0;i<n;i++) { omega[j]+=wi[i]*fi[i]*p[j+1][i]; } b[j]=omega[j]/gamma[j]; if( j != m) { alpha[j+1]=0; for(i=0;i<n;i++) { alpha[j+1]+=wi[i]*xi[i]*p[j+1][i]*p[j+1][i]/gamma[j]; } for(i=0;i<n;i++) { p[j+2][i]=(xi[i]-alpha[j+1])*p[j+1][i]-beta[j]*p[j][i]; } gamma[j+1]=0; for(i=0;i<n;i++) { gamma[j+1]+=wi[i]*p[j+2][i]*p[j+2][i]; } beta[j+1]=gamma[j+1]/gamma[j]; } }//end of j for(j=0;j<m+1;j++) { a[0][j]=b[j]; a[1][j]=alpha[j]; a[2][j]=beta[j]; } return a; }

public static double f_orhogonal_polynomial(double a[][],double x) {

va
254

dil

i.c o

m

255

ww w. ja

public static void amoeba(double p[][], double y[], int ndim, double ftol, f_xi ff, int nfunk) { int i,ihi,ilo,inhi,j,mpts=ndim+1; int NMAX=5000; double rtol,sum,swap,ysave,ytry; double psum[]=new double[ndim]; nfunk=0; for (j=1;j<=ndim;j++) { for (sum=0.0,i=1;i<=mpts;i++) sum += p[i-1][j-1]; psum[j-1]=sum; } for (;;) { ilo=1; //ihi = y[1]>y[2] ? (inhi=2,1) : (inhi=1,2); if(y[0]>y[1]) { inhi=2; ihi=1; } else { inhi=1; ihi=2; } for (i=1;i<=mpts;i++) { if (y[i-1] <= y[ilo-1]) ilo=i; if (y[i-1] > y[ihi-1]) { inhi=ihi;

va
255

dil

//minimization of a function public static double amotry(double p[][], double y[], double psum[], int ndim, f_xi ff, int ihi, double fac) { int j; double fac1,fac2,ytry; double ptry[]=new double[ndim]; fac1=(1.0-fac)/ndim; fac2=fac1-fac; for (j=1;j<=ndim;j++) ptry[j-1]=psum[j-1]*fac1-p[ihi-1][j-1]*fac2; ytry=ff.func(ptry,0); if (ytry < y[ihi-1]) { y[ihi-1]=ytry; for (j=1;j<=ndim;j++) { psum[j-1] += ptry[j-1]-p[ihi-1][j-1]; p[ihi-1][j-1]=ptry[j-1]; } } return ytry; }

i.c o

m

for(k=m-1;k>=0;k--) { q[k]=a[0][k]+(x-a[1][k+1])*q[k+1]-a[2][k+1]*q[k+2]; yy=q[k]; } return yy; }

256

1][j-1]); 1];

va
} } 256

} rtol=2.0*Math.abs(y[ihi-1]-y[ilo-1]) /(Math.abs(y[ihi-1])+Math.abs(y[ilo-1])); if (rtol < ftol) { swap=y[0]; y[0]=y[ilo-1]; y[ilo-1]=swap; for (i=1;i<=ndim;i++) { swap=p[0][i-1]; p[0][i-1]=p[ilo-1][i-1]; p[ilo-1][i-1]=swap; } break; } if (nfunk >= NMAX) System.out.println("NMAX exceeded"); nfunk += 2; ytry=amotry(p,y,psum,ndim,ff,ihi,-1.0); if (ytry <= y[ilo-1]) ytry=amotry(p,y,psum,ndim,ff,ihi,2.0); else if (ytry >= y[inhi-1]) { ysave=y[ihi-1]; ytry=amotry(p,y,psum,ndim,ff,ihi,0.5); if (ytry >= ysave) { for (i=1;i<=mpts;i++) { if (i != ilo) { for (j=1;j<=ndim;j++) psum[j-1]=0.5*(p[i-1][j-1]+p[ilo-

ww w. ja
p[i][j]; } } } } else --nfunk;

} nfunk += ndim; for (j=1;j<=ndim;j++) { for (sum=0.0,i=1;i<=mpts;i++) sum += psum[j]=sum;

// differential equation solutions public static double[] RK4(f_xi fp,double x0,double xn,double f0,int N) { //4th order Runge Kutta Method //fp :given derivative function df/dx(f,x) // xo : initial value of the independent variable // xn : final value of the independent variable // f0 : initial value of the dependent variable // N : number of dependent variable to be calculated // fi : dependent variable double h=(xn-x0)/N; double fi[]=new double[N+1];

dil
y[i]=ff.func(psum,0);

i.c o

m

ihi=i; } else if (y[i-1] > y[inhi-1] && i != ihi) inhi=i;

p[i-1][j-1]=psum[j-

257

ww w. ja

public static double[][] RK4(f_xi fp,double x0,double xn,double f0[],int N) { //4th order Runge Kutta Method //fp : given set of derivative functions dfj/dxi(fj,x) // xo : initial value of the independent variable // xn : final value of the independent variable // f0 : initial value of the dependent variable // N : number of dependent variable to be calculated // fi : dependent variable double h=(xn-x0)/N; int M=f0.length; double fi[][]; fi=new double[M][N+1]; double xi[]=new double[M+1]; double k[]=new double[4]; int i,j; double x; for(j=0;j<=M;j++) fi[j][0]=f0[j]; for(x=x0,i=0;x<xn;x+=h,i++) { for(j=1;j<=M;j++) { xi[0]=x; xi[1]=fi[j-1][i]; k[0]=h*fp.func(xi,j-1); xi[0]=x+h/2.0; xi[1]=fi[j-1][i]+k[0]/2; k[1]=h*fp.func(xi,j-1); xi[1]=fi[j-1][i]+k[1]/2.0; k[2]=h*fp.func(xi,j-1); xi[0]=x+h; xi[1]=fi[j-1][i]+k[2]; k[3]=h*fp.func(xi,j-1); fi[j-1][i+1]=fi[j-1][i]+k[0]/6.0+k[1]/3.0+k[2]/3.0+k[3]/6.0; } }

va
257

dil

double xi[]=new double[2]; double k[]; k=new double[4]; int i; double x; fi[0]=f0; for(x=x0,i=0;x<xn;x+=h,i++) { xi[0]=x; xi[1]=fi[i]; k[0]=h*fp.func(xi,0); xi[0]=x+h/2.0; xi[1]=fi[i]+k[0]/2; k[1]=h*fp.func(xi,0); xi[1]=fi[i]+k[1]/2.0; k[2]=h*fp.func(xi,0); xi[0]=x+h; xi[1]=fi[i]+k[2]; k[3]=h*fp.func(xi,0); fi[i+1]=fi[i]+k[0]/6.0+k[1]/3.0+k[2]/3.0+k[3]/6.0; } return fi; }

i.c o

m

258

ww w. ja

public static double[][] RKF45(f_xi fp,double x0,double xn,double f0,int N) throws IOException { // Runge Kutta - Fehlberg Method // fp : derivative function df/dx(f,x) (defined as a class) // Tol :Tolerance //Hmax : maximum possible step size //Hmin : minimum possible step size //k : Runge kutta coefficients //Err : error //x[i] : input variable to fp = df/dx(f,x) = df/dx(x[i]) //j : actual step size //fi[][]:solution matrix //fj[][]:solution matrix in exact size(j) (return function) double h=(xn-x0)/N; double fi[][]=new double[2][1000]; double Tol=2.0e-3; double Hmin=h/64.0; double Hmax=h*64.0; double k[]=new double[6]; double Err; double s; double xi[]=new double[2]; int j=0; fi[0][j]=x0; fi[1][j]=f0; while(fi[0][j] < xn ) { if(fi[0][j]+h > xn) h=xn-fi[0][j]; xi[0]=fi[0][j]; xi[1]=fi[1][j]; k[0]=h*fp.func(xi,0); xi[0]=fi[0][j]+h/4.0; xi[1]=fi[1][j]+k[0]/4.0; k[1]=h*fp.func(xi,0); xi[0]=fi[0][j]+3.0/8.0*h; xi[1]=fi[1][j]+3.0/32.0*k[0]+9.0/32.0*k[1]; k[2]=h*fp.func(xi,0); xi[0]=fi[0][j]+12.0/13.0*h; xi[1]=fi[1][j]+1932.0/2197.0*k[0]-7200.0/2197.0*k[1]+7296.0/2197.0*k[2]; k[3]=h*fp.func(xi,0); xi[0]=fi[0][j]+h; xi[1]=fi[1][j]+439.0/216.0*k[0]-8.0*k[1]+3680.0/513.0*k[2]845.0/4104.0*k[3]; k[4]=h*fp.func(xi,0); xi[0]=fi[0][j]+0.5*h; xi[1]=fi[1][j]-8.0/27.0*k[0]+2.0*k[1] -3544/2565*k[2]+1859.0/4104.0*k[3]-11.0/40.0*k[4]; k[5]=h*fp.func(xi,0); Err=Math.abs(1.0/360.0*k[0]-128/4275*k[2] -2197.0/75240*k[3]+1.0/5.0*k[4]+2.0/55.0*k[5]); if(Err<Tol || h<2*Hmin) { fi[0][j+1]=fi[0][j]+h; fi[1][j+1]=fi[1][j]+16.0/135.0*k[0]+6656.0/12825.0*k[2]+ 28561.0/56430.0*k[3]-9.0/50.0*k[4]+2.0/55.0*k[5]; j++; }

va
258

dil

i.c o

m

return fi; }

259

//End of Class Numeric }

Numeric sınıfı örnek problemleri :

1. Non linear denklem çözümleri :
import java.io.*; import Numeric; import complex;

ww w. ja
class df1 extends fij_xi { double[][] func(double x[]) { double b[][]; b=new double[2][2]; b[0][0]=2.0*x[0]; b[0][1]=-1.0; b[1][0]=2.0*x[0]-4.0; b[1][1]=2.0*x[1]-4.0; return b; } } class f2 extends f_x { double func(double x) { return Math.sin(x)-x/2;

class f1 extends fi_xi { double[] func(double[] x) { double b[]; b=new double[2]; b[0]=x[0]*x[0]-x[1]-1; b[1]=(x[0]-2)*(x[0]-2)+(x[1]-0.5)*(x[1]-0.5)-1.0; return b; } }

va
259

dil

i.c o

else { if(Err==0) s=0; else s=0.84*(Math.pow(Tol*h/Err,0.25)); if(s<0.75 && h>(2*Hmin) ) h/=2.0; if(s>1.5 && Hmax >(2*h) ) h*=2.0; } } double fj[][]=new double[2][j+1]; for(int i=0;i<=j;i++) { fj[0][i]=fi[0][i]; fj[1][i]=fi[1][i]; } return fj; }

m

260

ww w. ja

class Matrix2 { public static void main(String args[]) throws IOException { //Solution of zero of functions of one or multivariable equations f1 b1; b1=new f1(); df1 db1; db1=new df1(); f2 b2; b2=new f2(); df2 db2; db2=new df2(); double x[]; x=new double[2]; x[0]=0; x[1]=0.5; double xx=2.5; System.out.println("Roots of equations : "); System.out.println("Newtons method y=f(x)=0 f(x) and df(x)/dx is given"); System.out.println("Newton y,dy x= "+Numeric.newton(xx,b2,db2)); System.out.println(""); System.out.println("Newtons method y=f(x)=0 f(x) is given"); System.out.println("Newton y, x= "+Numeric.newton(xx,b2)); System.out.println(""); System.out.println("Newtons method with 2nd derivative y=f(x)=0 "); System.out.println("f(x) and df(x)/dx is given "); System.out.println("Newton_2nd_derivative y,dy x= "+ Numeric.newton_2nd_derivative(xx,b2,db2)); System.out.println(""); System.out.println("Newtons method with 2nd derivative y=f(x)=0 "); System.out.println("f(x) is given only "); System.out.println("Newton_2nd_derivative y, x= "+ Numeric.newton_2nd_derivative(xx,b2)); System.out.println(""); System.out.println("Secant method with 2nd derivative y=f(x)=0 "); System.out.println("f(x) is given only "); System.out.println("Secant_2nd_derivative y, x= "+ Numeric.secant_2nd_derivative(xx,b2)); System.out.println(""); System.out.println("Newtons method for system of equations"); System.out.println("yi=fi(xi)=0,i=0,n "); System.out.println("fi(xi) and dfi(xi)/dxj,i=1,n,j=1,n is given"); System.out.println(" "+Matrix.toStringT(Numeric.newton(x,b1,db1))); System.out.println(""); System.out.println("Newtons method for system of equations"); System.out.println("yi=fi(xi)=0,i=0,n ");

va
260

dil

i.c o

class df2 extends f_x { double func(double x) { return Math.cos(x)-0.5; } }

m

} }

261

}

}

Çözüm seti :

Roots of equations : Newtons method y=f(x)=0 f(x) and df(x)/dx is given Newton y,dy x= 1.895494267033981 Newtons method y=f(x)=0 f(x) is given Newton y, x= 1.895494267033981

Newtons method with 2nd derivative y=f(x)=0 f(x) and df(x)/dx is given Newton_2nd_derivative y,dy x= 1.895494267033981 Newtons method with 2nd derivative y=f(x)=0 f(x) is given only Newton_2nd_derivative y, x= 1.895494267033981 Secant method with 2nd derivative y=f(x)=0 f(x) is given only Secant_2nd_derivative y, x= 1.895494267033981 Newtons method for system of equations yi=fi(xi)=0,i=0,n fi(xi) and dfi(xi)/dxj,i=1,n,j=1,n is given 1.0673460858066892 0.13922766688686042

ww w. ja
2. Türev – İntegral
class f1 extends f_x { double func(double x) { return x*x; }

Newtons method for system of equations yi=fi(xi)=0,i=0,n fi(xi),i=1,n is given(derivative matrix is notrequired) 1.0673460858066897 0.1392276668868614

//====================================================== // Numerical Analysis package in java // example to show utilisation of integration (integral) // and differentiation (derivative) functions // Dr. Turhan Coban // ===================================================== import java.io.*; import Numeric; import complex;

va
261

dil

i.c o

m

System.out.println("fi(xi),i=1,n is given(derivative matrix is notrequired)"); System.out.println(" "+Matrix.toStringT(Numeric.newton(x,b1)));

262

} class f2 extends f_x { double func(double x) { return x; } }

ww w. ja

class fm2 extends fi_xi { //multivariable function double[] func(double x[]) { double a[]; a=new double[3]; a[0]=(x[0]+x[1]*x[1]+x[2]*2); a[1]=(x[0]*3+x[1]*x[1]*x[1]+x[2]); a[2]=(x[0]-5*x[1]*x[1]+x[2]*x[2]*x[2]); return a; } }

class integ1 { public static void main(String args[]) throws IOException { f1 b1; b1=new f1(); f2 b2; b2=new f2(); fm1 b3; b3=new fm1(); double x[]; fm2 b4; b4=new fm2(); x=new double[3]; x[0]=1; x[1]=2; x[2]=3; System.out.println("integral of class f1 : "+ Numeric.integral(b1,0.0,1.0)); System.out.println("romberg integral of class f1 : "+ Numeric.integral_romberg(b1,0.0,1.0));

va
262

dil

class fm1 extends f_xi { //multivariable function double func(double x[],int x_ref) { double a=0; switch(x_ref) { case 0: a=(x[0]+x[1]*x[1]+x[2]*2);break; case 1: a=(x[0]*3+x[1]*x[1]*x[1]+x[2]);break; case 2: a=(x[0]-5*x[1]*x[1]+x[2]*x[2]*x[2]);break; } return a; } }

i.c o

m

263

f1 : "+ f2 : "+ : : : : "+ "+ "+ "+

of fm2,0 of fm1,0 of fm2,0

} }

çözüm :

3. Least square polinom uydurma

ww w. ja
import java.io.*; import Numeric; import Text;

//=========================================== // Polynomial least square curve fitting // Dr. Turhan Coban //===========================================

class least { public static void main(String args[]) throws IOException { //polynomial least square curve fitting double e[]; //coefficients of polynomial least square e=new double[20]; double xi[]; xi=new double[500]; double yi[]; yi=new double[500]; DataInputStream cin=new DataInputStream(System.in); System.out.println("name of input file : "); String in_name=Text.readString(cin); System.out.println(" "); DataInputStream fin=new DataInputStream(new FileInputStream(in_name)); PrintStream fout=new PrintStream(new FileOutputStream("out.dat"));

va
263

integral of class f1 : 0.333333333333329 romberg integral of class f1 : 0.3333333333333333 integral of class f2 : 0.49999999999999384 Derivative of class f1 : 1.9999999999994864 Derivative of class f2 : 0.9999999999998606 Derivative of fm1,0 : 3.0000000000028932 Derivative of fm2,0 : 3.0000000000028932 Derivative of fm1,0 : 3.0000000000028932 Derivative of fm2,0 : 3.0000000000028932

dil

i.c o

System.out.println("Derivative Numeric.derivative(b3,1,x,0)); System.out.println("Derivative Numeric.derivative(b4,1,x,0)); System.out.println("Derivative Numeric.derivative(b3,1,x,0)); System.out.println("Derivative Numeric.derivative(b4,1,x,0)); System.in.read();

of fm1,0

m

System.out.println("integral of class Numeric.integral(b2,0.0,1.0)); System.out.println("Derivative of class Numeric.derivative(b1,1.0)); System.out.println("Derivative of class Numeric.derivative(b2,1.0));

f2 : "+

264

ww w. ja
4. Diferansiyel denklemler :
class fm1 extends f_xi { //multivariable function double func(double x[],int x_ref)

int i=-1; try { while(fin != null) { i++; xi[i]=Text.readDouble(fin); yi[i]=Text.readDouble(fin); System.out.println(" "+xi[i]+" "+yi[i]); } } catch(EOFException e_eof) {System.out.println("end of file"); } System.out.println("degree of curve fitting : "); int n=Text.readInt(cin); e=Numeric.poly_least_square(xi,yi,n); System.out.println(Matrix.toString(e)); fout.println(Matrix.toString(e)); System.out.println("least square error : "+Numeric.error(xi,yi,e)); System.out.println("would you like to send curve fitted data to a data file (y/n) "); char answer=Text.readChar(cin); if(answer=='y') { System.out.println("name of output file : "); String out_name=Text.readString(cin); PrintStream fout1=new PrintStream(new FileOutputStream(out_name)); double xmin,xmax; System.out.println("minimum x : "); xmin=Text.readDouble(cin); System.out.println("maximum x : "); xmax=Text.readDouble(cin); System.out.println("number of data points : "); int n_data=Text.readInt(cin); double x; for(i=0;i<n_data;i++) { x=xmin+(xmax-xmin)/(n_data-1.0)*i; System.out.println(" "+x+" "+Numeric.f_least_square(e,x)); fout1.println(" "+x+" "+Numeric.f_least_square(e,x)); } //end of for }//end of if } }

//====================================================== // Numerical Analysis package in java // example to show differential equation solution // and differentiation (derivative) functions // Dr. Turhan Coban // ===================================================== import java.io.*; import Numeric; import complex; import Matrix;

va
264

dil

i.c o

m

265

{

} }

class dif1 { public static void main(String args[]) throws IOException {

ww w. ja
265

1.0 1.02020134 1.0408107741377959 1.0618365464618167 1.0832870675613175 1.1051709179307265 1.1274968514019572 1.1502737986460576 1.1735108707455981 1.197217362839226 1.2214027578398445 1.2460767302279048 1.271249149921327 1.2969300862235986 1.3231298118516308 1.3498588070449815 1.3771277637580916 1.4049475899372086 1.4333294138837107 1.4622845887055762 1.4918246968587778 1.5219615547804188 1.5527072176154666 1.5840739840389706 1.6160744011756962 1.648721269619143 1.682027648551951 1.7160068609697496 1.7506724990105325 1.7860384293916938 1.8221187989569014 1.8589280403350215 1.896480877713363 1.9347923327275491

va

dil

fm1 b3=new fm1(); double x[]; x=new double[1]; x[0]=1; //RK5 differential equation to solve differential equation dy/dx=y //with limits 0 to 1 exact solution is e=2.7182818 //boundary condition x=0 y=1 is given //final value x=1 to be calculated by the method System.out.println(Matrix.toStringT(Numeric.RK4(b3,0.0,1.0,1.0,50))); } }

i.c o

m

//x[0] is x, x[1] is y //this is a representation of equation : dy/dx=y //solution of this equation is e(x) if(x_ref==0) return x[1]; else return 0;

266

ww w. ja
Cözüm :
0.0 -1.0

class fm1 extends f_xi { //multivariable function double func(double x[],int x_ref) { //x[0] is x, x[1] is y if(x_ref==0) return -2.0*x[0]-x[1]; else return 0; } }

class dif2 { public static void main(String args[]) throws IOException { fm1 b3=new fm1(); double x[]; x=new double[1]; x[0]=1; //RK5 differential equation to solve equation dy/dx=-2x-y //initial value is given as x=0 y=-1 at x=0.4 y will be determined System.out.println (Matrix.toString(Matrix.T(Numeric.RKF45(b3,0.0,0.4,-1.0,10)))); } }

va
266

dil

//====================================================== // Numerical Analysis package in java // example to show differential equation solution // and differentiation (derivative) functions // Dr. Turhan Coban // ===================================================== import java.io.*; import Numeric; import complex; import Matrix;

i.c o

1.9738777304703714 2.0137527056220317 2.0544332087042223 2.095935512460547 2.1382762183658373 2.1814722632669596 2.2255409261577848 2.270499835091013 2.3163669742296302 2.363160691040814 2.4108997036351645 2.4596031082541976 2.5092903869090972 2.5599814151737794 2.611696470135386 2.6644562385053905 2.7182818248945586

m

267

ww w. ja

0.0050 -0.9950377826066799 0.01 -0.9901501844020889 0.015 -0.9853368332473136 0.02 -0.9805973588593618 0.025 -0.9759313928019077 0.030000000000000002-0.9713385684760812 0.035 -0.9668185211113052 0.04 -0.9623708877561767 0.045 -0.9579953072693951 0.049999999999999996-0.9536914203107341 0.05499999999999999-0.94945886933206 0.05999999999999999-0.9452972985683943 0.06499999999999999-0.9412063540290199 0.06999999999999999-0.9371856834886335 0.075 -0.9332349364785408 0.08 -0.9293537642778962 0.085 -0.9255418199049855 0.09000000000000001-0.9217987581085532 0.09500000000000001-0.9181242353591716 0.10000000000000002-0.9145179098406548 0.10500000000000002-0.9109794414415133 0.11000000000000003-0.9075084917464531 0.11500000000000003-0.9041047240279163 0.12000000000000004-0.9007678032376644 0.12500000000000003-0.8974973959984025 0.13000000000000003-0.8942931705954467 0.13500000000000004-0.891154796968432 0.14000000000000004-0.8880819467030621 0.14500000000000005-0.8850742930228999 0.15000000000000005-0.8821315107811996 0.15500000000000005-0.8792532764527788 0.16000000000000006-0.8764392681259321 0.16500000000000006-0.8736891654943832 0.17000000000000007-0.8710026498492798 0.17500000000000007-0.8683794040712255 0.18000000000000008-0.8658191126223544 0.18500000000000008-0.8633214615384427 0.19000000000000009-0.8608861384210608 0.1950000000000001-0.8585128324297647 0.2000000000000001-0.856201234274326 0.2050000000000001-0.8539510362070005 0.2100000000000001-0.8517619320148359 0.2150000000000001-0.849633617012017 0.2200000000000001-0.8475657880322502 0.22500000000000012-0.8455581434211851 0.23000000000000012-0.843610383028874 0.23500000000000013-0.8417222082022695 0.24000000000000013-0.8398933217777589 0.24500000000000013-0.8381234280737365 0.2500000000000001-0.8364122328832122 0.2550000000000001-0.8347594434664576 0.2600000000000001-0.8331647685436885 0.2650000000000001-0.8316279182877833 0.27000000000000013-0.8301486043170393 0.27500000000000013-0.8287265396879636 0.28000000000000014-0.8273614388881004 0.28500000000000014-0.8260530178288946 0.29000000000000015-0.8248009938385901 0.29500000000000015-0.8236050856551641 0.30000000000000016-0.8224650134192967 0.30500000000000016-0.8213804986673754

va
267

dil

i.c o

m

268

ww w. ja
Çözüm :

class fm1 extends f_xi { //multivariable function double func(double x[],int x_ref) { //x[0] is x, x[1] is y if(x_ref==0) return -2.0*x[0]-x[1]; else return 0; } }

class dif3 { public static void main(String args[]) throws IOException { fm1 b3=new fm1(); double x[]; x=new double[1]; x[0]=1; //RK4 differential equation to solve equation dy/dx=-2x-y System.out.println(Matrix.toStringT(Numeric.RK4(b3,0.0,0.4,-1.0,100))); System.in.read(); } }

va
268

//====================================================== // Numerical Analysis package in java // example to show differential equation solution // and differentiation (derivative) functions // Dr. Turhan Coban // ===================================================== import java.io.*; import Numeric; import complex; import Matrix;

dil

i.c o

0.31000000000000016-0.8203512643245341 0.31500000000000017-0.8193770346977273 0.3200000000000002-0.8184575354688391 0.3250000000000002-0.8175924936878259 0.3300000000000002-0.8167816377658933 0.3350000000000002-0.8160246974687078 0.3400000000000002-0.8153214039096416 0.3450000000000002-0.8146714895430517 0.3500000000000002-0.8140746881575915 0.3550000000000002-0.8135307348695573 0.3600000000000002-0.8130393661162659 0.3650000000000002-0.812600319649468 0.3700000000000002-0.8122133345287916 0.3750000000000002-0.8118781511152201 0.3800000000000002-0.8115945110646018 0.38500000000000023-0.8113621573211925 0.39000000000000024-0.8111808341112298 0.39500000000000024-0.8110502869365394 0.4 -0.8109702625681743

m

269

ww w. ja
269

-1.0 -0.9960239680320001 -0.992095744511233 -0.9882151385858677 -0.9843819601659565 -0.9805960199203918 -0.9768571292738785 -0.9731651004039156 -0.9695197462377918 -0.9659208804495921 -0.9623683174572164 -0.9588618724194105 -0.955401361232808 -0.9519866005289858 -0.9486174076715289 -0.945293600753109 -0.942014998592574 -0.9387814207320486 -0.9355926874340476 -0.9324486196785992 -0.9293490391603817 -0.9262937682858702 -0.9232826301704945 -0.9203154486358103 -0.9173920482066786 -0.9145122541084599 -0.9116758922642163 -0.9088827892919272 -0.9061327725017148 -0.903425669893081 -0.900761310152156 -0.898139522648956 -0.8955601374346547 -0.8930229852388627 -0.8905278974669202 -0.888074706197199 -0.8856632441784156 -0.8832933448269559 -0.8809648422242088 -0.8786775711139124 -0.8764313668995095 -0.8742260656415141 -0.872061504054888 -0.8699375195064296 -0.8678539500121697 -0.8658106342347813 -0.8638074114809979 -0.8618441216990421 -0.8599206054760645 -0.8580367040355941 -0.8561922592349969 -0.854387113562946 -0.8526211101369017 -0.8508940927006006 -0.8492059056215563 -0.8475563938885688 -0.8459454031092447 -0.8443727795075264 -0.8428383699212321 -0.8413420217996048

va

dil

i.c o

m

270

ww w. ja
270

-0.8398835832008722 -0.8384629027898148 -0.8370798298353451 -0.8357342142080957 -0.8344259063780173 -0.8331547574119857 -0.8319206189714199 -0.8307233433099079 -0.8295627832708429 -0.8284387922850687 -0.8273512243685349 -0.826299934119961 -0.8252847767185101 -0.8243056079214711 -0.8233622840619519 -0.8224546620465801 -0.8215825993532133 -0.8207459540286591 -0.8199445846864039 -0.8191783505043502 -0.8184471112225643 -0.8177507271410314 -0.8170890591174206 -0.8164619685648588 -0.8158693174497131 -0.8153109682893825 -0.8147867841500976 -0.8142966286447304 -0.8138403659306118 -0.8134178607073579 -0.8130289782147054 -0.8126735842303556 -0.8123515450678265 -0.8120627275743135 -0.8118069991285605 -0.8115842276387357 -0.8113942815403203 -0.811237029794002 -0.8111123418835786 -0.8110200878138704 -0.8109601381086393

va

dil

i.c o

m

271

EK A TEXT SINIFI

ww w. ja
} IOException {

class Text { /* Text class by J M Bishop Aug 1996 Text book : Java gently, Addison Westley Longman 1997 ISBN 0-201-59399-8 provides simple input from the keyboard and files. Routines provided are: public static void prompt(String s); public static int readInt(DataInputStream in); public static int readDouble (DataInputStreamin); public static int readString (DataInputStream in); public static int readChar (DataInputStream in); ---------------------------------------------------Sample use : --------- reading a double-------------DataInputStream cin=new DataInputStream(system.in); double number; number=Text.readDouble(cin); ------ reading data from a file "datafile.dat"-----DataInputStream fin=new DataInputStream (new FileInputStream("datafile.dat")); double number; number=Text.readDouble(fin); ------ printing data into a file "printfile.dat"---PrintStream fout=new PrintStream (new FileOutputStream("printfile.dat")); String a="turhan"; fout.println(a); ---------------------------------------------------*/ public Text () {} ; private static StringTokenizer T; private static String S; public static void prompt (String s) { System.out.print(s + " "); System.out.flush();

public static int readInt (DataInputStream in) throws if (T==null) refresh(in); while (true)

va
271

dil

i.c o

//============================================ // Numerical Analysis Package in Java // Class Text to read data from screen or file // and write (by using print) to screen or file // formatted c printf like comand structure // Dr. Turhan Coban //============================================ import java.io.*; import java.util.*;

m

272 {

IOException

public static char readChar (DataInputStream in) throws {

}

ww w. ja
IOException { }

public static double readDouble(DataInputStream in) throws IOException { if(T==null) refresh(in); while (true) { try { String item = T.nextToken(); return Double.valueOf (item.trim()).doubleValue(); } catch(NoSuchElementException e1) { refresh (in); } catch(NumberFormatException e2) { System.out.println("Error in number, try again."); } } } public static String readString(DataInputStream in) throws if(T==null) refresh (in); while (true) { try {return T.nextToken();} catch (NoSuchElementException e1) { refresh (in); } }

public static String readStringLine(DataInputStream in) throws IOException { //reads a line of strings from DataInputStream in int ch; String r = "";

va
272

dil

if (T==null) refresh(in); while (true) { try { return T.nextToken().charAt(0); } catch(NoSuchElementException e1) {refresh (in);} }

i.c o

try { String item = T.nextToken(); return Integer.valueOf(item.trim()).intValue(); } catch (NoSuchElementException e1) { refresh (in); } catch(NumberFormatException e2) { System.out.println("Error in number, try again.");} } }

m

273 boolean done = false; while (!done) { try { ch = in.read(); if (ch < 0 || (char)ch == '\n' || (char)ch == '\0') done = true; else r = r + (char) ch; } catch(java.io.IOException e) { done = true; } } return r.substring(0,(r.length()-1)); }

private static void refresh (DataInputStream in) throws IOException { S = in.readLine (); if (S==null) throw new EOFException(); T=new StringTokenizer (S); }

ww w. ja

/* * Following part of the class Text is adapted from Core Java Book * Originally defined as Format class * Gary Cornell and Cay S. Horstmann, Core Java (Book/CD-ROM) * Published By SunSoft Press/Prentice-Hall * Copyright (C) 1996 Sun Microsystems Inc. * All Rights Reserved. ISBN 0-13-565755-5 * * Permission to use, copy, modify, and distribute this * software and its documentation for NON-COMMERCIAL purposes * and without fee is hereby granted provided that this * copyright notice appears in all copies. * * THE AUTHORS AND PUBLISHER MAKE NO REPRESENTATIONS OR * WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THE AUTHORS * AND PUBLISHER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED * BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING * THIS SOFTWARE OR ITS DERIVATIVES. */ /** * A class for formatting numbers that follows printf conventions. * Also implements C-like atoi and atof functions * @version 1.01 15 Feb 1996 * @author Cay Horstmann */ /** * Formats the number following printf conventions. * Main limitation: Can only handle one format parameter at a time * Use multiple Format objects to format more than one number * @param s the format string following printf conventions * The string has a prefix, a format code and a suffix. The prefix and suffix

va
273

dil

i.c o

m

274 * become part of the formatted output. The format code directs the * formatting of the (single) parameter to be formatted. The code has the * following structure * <ul> * <li> a % (required) * <li> a modifier (optional) * <dl> * <dt> + <dd> forces display of + for positive numbers * <dt> 0 <dd> show leading zeroes * <dt> - <dd> align left in the field * <dt> space <dd> prepend a space in front of positive numbers * <dt> # <dd> use "alternate" format. Add 0 or 0x for octal or hexadecimal numbers. Don't suppress trailing zeroes in general floating point format. * </dl> * <li> an integer denoting field width (optional) * <li> a period followed by an integer denoting precision (optional) * <li> a format descriptor (required) * <dl> * <dt>f <dd> floating point number in fixed format * <dt>e, E <dd> floating point number in exponential notation (scientific format). The E format results in an uppercase E for the exponent (1.14130E+003), the e format in a lowercase e. * <dt>g, G <dd> floating point number in general format (fixed format for small numbers, exponential format for large numbers). Trailing zeroes are suppressed. The G format results in an uppercase E for the exponent (if any), the g format in a lowercase e. * <dt>d, i <dd> integer in decimal * <dt>x <dd> integer in hexadecimal * <dt>o <dd> integer in octal * <dt>s <dd> string * <dt>c <dd> character * </dl> * </ul> * @exception IllegalArgumentException if bad format */

ww w. ja

public Text(String s) { width = 0; precision = -1; pre = ""; post = ""; leading_zeroes = false; show_plus = false; alternate = false; show_space = false; left_align = false; fmt = ' ';

int state = 0; int length = s.length(); int parse_state = 0; // 0 = prefix, 1 = flags, 2 = width, 3 = precision, // 4 = format, 5 = end int i = 0; while (parse_state == 0) { if (i >= length) parse_state = 5; else if (s.charAt(i) == '%') { if (i < length - 1) { if (s.charAt(i + 1) == '%')

va
274

dil

i.c o

m

275 { pre = pre + '%'; i++;

} else parse_state = 1; } else pre = pre + s.charAt(i); i++;

} else throw new java.lang.IllegalArgumentException();

ww w. ja
} /** * prints * @param * @param * @param */

} while (parse_state == 1) { if (i >= length) parse_state = 5; else if (s.charAt(i) == ' ') show_space = true; else if (s.charAt(i) == '-') left_align = true; else if (s.charAt(i) == '+') show_plus = true; else if (s.charAt(i) == '0') leading_zeroes = true; else if (s.charAt(i) == '#') alternate = true; else { parse_state = 2; i--; } i++; } while (parse_state == 2) { if (i >= length) parse_state = 5; else if ('0' <= s.charAt(i) && s.charAt(i) <= '9') { width = width * 10 + s.charAt(i) - '0'; i++; } else if (s.charAt(i) == '.') { parse_state = 3; precision = 0; i++; } else parse_state = 4; } while (parse_state == 3) { if (i >= length) parse_state = 5; else if ('0' <= s.charAt(i) && s.charAt(i) <= '9') { precision = precision * 10 + s.charAt(i) - '0'; i++; } else parse_state = 4; } if (parse_state == 4) { if (i >= length) parse_state = 5; else fmt = s.charAt(i); i++; } if (i < length) post = s.substring(i, length);

a formatted number following printf conventions s a PrintStream fmt the format string x the double to print

va
275

dil

i.c o

m

276 public static void print(java.io.PrintStream s, String fmt, double x) { s.print(new Text(fmt).form(x)); } /** * prints a formatted number following printf conventions * @param s a PrintStream * @param fmt the format string * @param x the long to print */ public static void print(java.io.PrintStream s, String fmt, long x) { s.print(new Text(fmt).form(x)); } /** * prints * @param * @param * @param */ a formatted number following printf conventions s a PrintStream fmt the format string x the character to

public static void print(java.io.PrintStream s, String fmt, char x) { s.print(new Text(fmt).form(x)); } /** * prints a formatted number following printf conventions * @param s a PrintStream, fmt the format string * @param x a string that represents the digits to print */

public static void print(java.io.PrintStream s, String fmt, String x) { s.print(new Text(fmt).form(x)); } /** * Converts a string of digits (decimal, octal or hex) to an integer * @param s a string * @return the numeric value of the prefix of s representing a base 10 integer */ public static int atoi(String s) { return (int)atol(s); }

ww w. ja
public static long atol(String s) { int i = 0;

/** * Converts a string of digits (decimal, octal or hex) to a long integer * @param s a string * @return the numeric value of the prefix of s representing a base 10 integer */

while (i < s.length() && Character.isSpace(s.charAt(i))) i++; if (i < s.length() && s.charAt(i) == '0') { if (i + 1 < s.length() && (s.charAt(i + 1) == 'x' || s.charAt(i + 1) == 'X')) return parseLong(s.substring(i + 2), 16);

va
276

dil

i.c o

m

277 else return parseLong(s, 8); } else return parseLong(s, 10); } private static long parseLong(String s, int base) { int i = 0; int sign = 1; long r = 0;

}

ww w. ja

public static double atof(String s) { int i = 0; int sign = 1; double r = 0; // integer part double f = 0; // fractional part double p = 1; // exponent of fractional part int state = 0; // 0 = int part, 1 = frac part while (i < s.length() && Character.isSpace(s.charAt(i))) i++; if (i < s.length() && s.charAt(i) == '-') { sign = -1; i++; } else if (i < s.length() && s.charAt(i) == '+') { i++; } while (i < s.length()) { char ch = s.charAt(i); if ('0' <= ch && ch <= '9') { if (state == 0) r = r * 10 + ch - '0'; else if (state == 1) { p = p / 10; r = r + p * (ch - '0'); } } else if (ch == '.') { if (state == 0) state = 1; else return sign * r; } else if (ch == 'e' || ch == 'E') { long e = (int)parseLong(s.substring(i + 1), 10); return sign * r * Math.pow(10, e);

va
277

/** * Converts a string of digits to an double * @param s a string */

dil

while (i < s.length() && Character.isSpace(s.charAt(i))) i++; if (i < s.length() && s.charAt(i) == '-') { sign = -1; i++; } else if (i < s.length() && s.charAt(i) == '+') { i++; } while (i < s.length()) { char ch = s.charAt(i); if ('0' <= ch && ch < '0' + base) r = r * base + ch - '0'; else if ('A' <= ch && ch < 'A' + base - 10) r = r * base + ch - 'A' + 10 ; else if ('a' <= ch && ch < 'a' + base - 10) r = r * base + ch - 'a' + 10 ; else return r * sign; i++; } return r * sign;

i.c o

m

278 } else return sign * r; i++; } return sign * r; }

return pad(sign(s, r)); }

ww w. ja
return pad(sign(s, r)); } public String form(char c) { if (fmt != 'c')

public String form(long x) { String r; int s = 0; if (fmt == 'd' || fmt == 'i') { s = 1; if (x < 0) { x = -x; s = -1; } r = "" + x; } else if (fmt == 'o') r = convert(x, 3, 7, "01234567"); else if (fmt == 'x') r = convert(x, 4, 15, "0123456789abcdef"); else if (fmt == 'X') r = convert(x, 4, 15, "0123456789ABCDEF"); else throw new java.lang.IllegalArgumentException();

/** * Formats a character into a string (like sprintf in C) * @param x the value to format * @return the formatted string */

va
278

/** * Formats a long integer into a string (like sprintf in C) * @param x the number to format * @return the formatted string */

dil

public String form(double x) { String r; if (precision < 0) precision = 6; int s = 1; if (x < 0) { x = -x; s = -1; } if (fmt == 'f') r = fixed_Text(x); else if (fmt == 'e' || fmt == 'E' || fmt == 'g' || fmt == 'G') r = exp_Text(x); else throw new java.lang.IllegalArgumentException();

i.c o

/** * Formats a double into a string (like sprintf in C) * @param x the number to format * @return the formatted string * @exception IllegalArgumentException if bad argument */

m

279 throw new java.lang.IllegalArgumentException(); String r = "" + c; return pad(r); }

public String form(String s) { if (fmt != 's') throw new java.lang.IllegalArgumentException(); if (precision >= 0) s = s.substring(0, precision); return pad(s); } /** * a test stub for the format class */

ww w. ja
Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, "x "u "x "w "x "x "x "x "y "y "x "z "w "u "y "y = = = = = = = = = = = = = = = =

public static void main(String[] a) { double x = 1.23456789012; double y = 123; double z = 1.2345e30; double w = 1.02; double u = 1.234e-5; int d = 0xCAFE; Text.print(System.out, "x = |%f|\n", x); Text.print(System.out, "u = |%20f|\n", u); Text.print(System.out, "x = |% .5f|\n", x); Text.print(System.out, "w = |%20.5f|\n", w); Text.print(System.out, "x = |%020.5f|\n", x); Text.print(System.out, "x = |%+20.5f|\n", x); Text.print(System.out, "x = |%+020.5f|\n", x); Text.print(System.out, "x = |% 020.5f|\n", x); Text.print(System.out, "y = |%#+20.5f|\n", y); Text.print(System.out, "y = |%-+20.5f|\n", y); Text.print(System.out, "z = |%20.5f|\n", z);

va
279

dil
|%e|\n", x); |%20e|\n", u); |% .5e|\n", x); |%20.5e|\n", w); |%020.5e|\n", x); |%+20.5e|\n", x); |%+020.5e|\n", x); |% 020.5e|\n", x); |%#+20.5e|\n", y); |%-+20.5e|\n", y); |%g|\n", x); |%g|\n", z); |%g|\n", w); |%g|\n", u); |%.2g|\n", y); |%#.2g|\n", y);

i.c o

/** * Formats a string into a larger string (like sprintf in C) * @param x the value to format * @return the formatted string */

m

280 Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, Text.print(System.out, "d "d "d "d "d "d "d "d "d "d "d "d "d "d "d "d "d = = = = = = = = = = = = = = = = = |%d|\n", d); |%20d|\n", d); |%020d|\n", d); |%+20d|\n", d); |% 020d|\n", d); |%-20d|\n", d); |%20.8d|\n", d); |%x|\n", d); |%20X|\n", d); |%#20x|\n", d); |%020X|\n", d); |%20.8x|\n", d); |%o|\n", d); |%020o|\n", d); |%#20o|\n", d); |%#020o|\n", d); |%20.12o|\n", d);

Text.print(System.out, "s = |%-20s|\n", "Hello"); Text.print(System.out, "s = |%-20c|\n", '!'); }

private static String repeat(char c, int n) { if (n <= 0) return ""; StringBuffer s = new StringBuffer(n); for (int i = 0; i < n; i++) s.append(c); return s.toString(); }

ww w. ja

private static String convert(long x, int n, int m, String d) { if (x == 0) return "0"; String r = ""; while (x != 0) { r = d.charAt((int)(x & m)) + r; x = x >>> n; } return r; } private String pad(String r) { String p = repeat(' ', width - r.length()); if (left_align) return pre + r + p + post; else return pre + p + r + post; }

private String sign(int s, String r) { String p = ""; if (s < 0) p = "-"; else if (s > 0) { if (show_plus) p = "+"; else if (show_space) p = " "; } else { if (fmt == 'o' && alternate && r.length() > 0 && r.charAt(0) != '0') p = "0"; else if (fmt == 'x' && alternate) p = "0x"; else if (fmt == 'X' && alternate) p = "0X"; } int w = 0; if (leading_zeroes)

va
280

dil

i.c o

m

281 w = width; else if ((fmt == 'd' || fmt == 'i' || fmt == 'x' || fmt == 'X' || fmt == 'o') && precision > 0) w = precision; } return p + repeat('0', w - p.length() - r.length()) + r;

private String fixed_Text(double d) { String f = "";

if (d > 0x7FFFFFFFFFFFFFFFL) return exp_Text(d); long l = (long)(precision == 0 ? d + 0.5 : d); f = f + l; double fr = d - l; // fractional part if (fr >= 1 || fr < 0) return exp_Text(d); return f + frac_part(fr); }

ww w. ja
} if if // { } return z; }

z = leading_zeroes + l; z = z.substring(z.length() - precision, z.length());

(precision > 0 || alternate) z = "." + z; ((fmt == 'G' || fmt == 'g') && !alternate) remove trailing zeroes and decimal point int t = z.length() - 1; while (t >= 0 && z.charAt(t) == '0') t--; if (t >= 0 && z.charAt(t) == '.') t--; z = z.substring(0, t + 1);

private String exp_Text(double d) { String f = ""; int e = 0; double dd = d; double factor = 1; while (dd > 10) { e++; factor /= 10; dd = dd / 10; } while (dd < 1) { e--; factor *= 10; dd = dd * 10; } if ((fmt == 'g' || fmt == 'G') && e >= -4 && e < precision) return fixed_Text(d);

va
281

private String frac_part(double fr) // precondition: 0 <= fr < 1 { String z = ""; if (precision > 0) { double factor = 1; String leading_zeroes = ""; for (int i = 1; i <= precision && factor <= 0x7FFFFFFFFFFFFFFFL; i++) { factor *= 10; leading_zeroes = leading_zeroes + "0"; } long l = (long) (factor * fr + 0.5);

dil

i.c o

m

282

if (fmt == 'e' || fmt == 'g') f = f + "e"; else f = f + "E"; String p if (e >= { f = f p = p } else { f = f p = p } } private private private private private private private private private private = "000"; 0) + "+"; + e; + "-"; + (-e);

return f + p.substring(p.length() - 3, p.length()); int width; int precision; String pre; String post; boolean leading_zeroes; boolean show_plus; boolean alternate; boolean show_space; boolean left_align; char fmt; // one of cdeEfgGiosxXos }

ww w. ja
282

va

dil

i.c o

m

d = d * factor; f = f + fixed_Text(d);

283

EK B JAVA KÜTÜPHANESİ İNDEKSİ

ww w. ja

class java.lang.Object class java.awt.AWTEventMulticaster (implements java.awt.event.ComponentListener, java.awt.event.ContainerListener, java.awt.event.FocusListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.WindowListener, java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.event.AdjustmentListener, java.awt.event.TextListener) interface java.security.acl.Acl (extends java.security.acl.Owner) interface java.security.acl.AclEntry (extends java.lang.Cloneable) interface java.awt.event.ActionListener (extends java.util.EventListener) interface java.awt.Adjustable interface java.awt.event.AdjustmentListener (extends java.util.EventListener) class java.util.zip.Adler32 (implements java.util.zip.Checksum) interface java.applet.AppletContext interface java.applet.AppletStub class java.lang.reflect.Array interface java.applet.AudioClip interface java.beans.BeanInfo class java.beans.Beans class java.util.BitSet (implements java.lang.Cloneable, java.io.Serializable) class java.lang.Boolean (implements java.io.Serializable) class java.awt.BorderLayout (implements java.awt.LayoutManager2, java.io.Serializable) class java.text.BreakIterator (implements java.lang.Cloneable, java.io.Serializable) interface java.awt.peer.ButtonPeer (extends java.awt.peer.ComponentPeer) class java.util.zip.CRC32 (implements java.util.zip.Checksum) class java.util.Calendar (implements java.io.Serializable, java.lang.Cloneable) class java.util.GregorianCalendar interface java.sql.CallableStatement (extends java.sql.PreparedStatement) interface java.awt.peer.CanvasPeer (extends java.awt.peer.ComponentPeer) class java.awt.CardLayout (implements java.awt.LayoutManager2, java.io.Serializable) interface java.security.Certificate class java.lang.Character (implements java.io.Serializable) interface java.text.CharacterIterator (extends java.lang.Cloneable) class java.awt.CheckboxGroup (implements java.io.Serializable) interface java.awt.peer.CheckboxMenuItemPeer (extends java.awt.peer.MenuItemPeer) interface java.awt.peer.CheckboxPeer (extends java.awt.peer.ComponentPeer) interface java.util.zip.Checksum interface java.awt.peer.ChoicePeer (extends java.awt.peer.ComponentPeer) class java.lang.Class (implements java.io.Serializable) class java.lang.ClassLoader class java.awt.datatransfer.Clipboard interface java.awt.datatransfer.ClipboardOwner interface java.lang.Cloneable class java.text.CollationElementIterator class java.text.CollationKey class java.text.Collator (implements java.lang.Cloneable, java.io.Serializable) class java.text.RuleBasedCollator class java.awt.Color (implements java.io.Serializable) class java.awt.SystemColor (implements java.io.Serializable) class java.awt.image.ColorModel class java.awt.image.DirectColorModel class java.awt.image.IndexColorModel class java.lang.Compiler class java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) class java.awt.Button class java.awt.Canvas class java.awt.Checkbox (implements java.awt.ItemSelectable) class java.awt.Choice (implements java.awt.ItemSelectable) class java.awt.Container class java.awt.Panel class java.applet.Applet class java.awt.ScrollPane class java.awt.Window

va
283

dil

i.c o

m

284
class java.awt.Dialog class java.awt.FileDialog class java.awt.Frame (implements java.awt.MenuContainer) class java.awt.Label class java.awt.List (implements java.awt.ItemSelectable) class java.awt.Scrollbar (implements java.awt.Adjustable) class java.awt.TextComponent class java.awt.TextArea class java.awt.TextField class java.awt.event.ComponentAdapter (implements java.awt.event.ComponentListener) interface java.awt.event.ComponentListener (extends java.util.EventListener) interface java.awt.peer.ComponentPeer interface java.sql.Connection class java.lang.reflect.Constructor (implements java.lang.reflect.Member) class java.awt.event.ContainerAdapter (implements java.awt.event.ContainerListener) interface java.awt.event.ContainerListener (extends java.util.EventListener) interface java.awt.peer.ContainerPeer (extends java.awt.peer.ComponentPeer) class java.net.ContentHandler interface java.net.ContentHandlerFactory class java.awt.Cursor (implements java.io.Serializable) interface java.beans.Customizer interface java.rmi.dgc.DGC (extends java.rmi.Remote) interface java.security.interfaces.DSAKey interface java.security.interfaces.DSAKeyPairGenerator interface java.security.interfaces.DSAParams interface java.security.interfaces.DSAPrivateKey (extends java.security.interfaces.DSAKey, java.security.PrivateKey) interface java.security.interfaces.DSAPublicKey (extends java.security.interfaces.DSAKey, java.security.PublicKey) class java.awt.datatransfer.DataFlavor interface java.io.DataInput interface java.io.DataOutput interface java.sql.DatabaseMetaData class java.net.DatagramPacket class java.net.DatagramSocket class java.net.MulticastSocket class java.net.DatagramSocketImpl (implements java.net.SocketOptions) class java.util.Date (implements java.io.Serializable, java.lang.Cloneable) class java.sql.Date class java.sql.Time class java.sql.Timestamp class java.text.DateFormatSymbols (implements java.io.Serializable, java.lang.Cloneable) interface sun.tools.debug.DebuggerCallback class java.text.DecimalFormatSymbols (implements java.lang.Cloneable, java.io.Serializable) class java.util.zip.Deflater interface java.awt.peer.DialogPeer (extends java.awt.peer.WindowPeer) class java.util.Dictionary class java.util.Hashtable (implements java.lang.Cloneable, java.io.Serializable) class java.util.Properties class java.security.Provider class java.awt.Dimension (implements java.io.Serializable) interface java.sql.Driver class java.sql.DriverManager class java.sql.DriverPropertyInfo interface java.util.Enumeration class java.awt.Event (implements java.io.Serializable) interface java.util.EventListener interface sunw.util.EventListener (extends java.util.EventListener) class java.util.EventObject (implements java.io.Serializable) class java.awt.AWTEvent class java.awt.event.ActionEvent class java.awt.event.AdjustmentEvent class java.awt.event.ComponentEvent class java.awt.event.ContainerEvent class java.awt.event.FocusEvent class java.awt.event.InputEvent class java.awt.event.KeyEvent class java.awt.event.MouseEvent class java.awt.event.PaintEvent

ww w. ja

va
284

dil

i.c o

m

285
class java.awt.event.WindowEvent class java.awt.event.ItemEvent class java.awt.event.TextEvent class sunw.util.EventObject class java.beans.PropertyChangeEvent class java.awt.EventQueue interface java.io.Externalizable (extends java.io.Serializable) class java.beans.FeatureDescriptor class java.beans.BeanDescriptor class java.beans.EventSetDescriptor class java.beans.MethodDescriptor class java.beans.ParameterDescriptor class java.beans.PropertyDescriptor class java.beans.IndexedPropertyDescriptor class java.lang.reflect.Field (implements java.lang.reflect.Member) class sun.tools.debug.Field class sun.tools.debug.RemoteField (implements sun.tools.debug.AgentConstants) class java.text.FieldPosition class java.io.File (implements java.io.Serializable) class java.io.FileDescriptor interface java.awt.peer.FileDialogPeer (extends java.awt.peer.DialogPeer) interface java.net.FileNameMap interface java.io.FilenameFilter class java.awt.image.FilteredImageSource (implements java.awt.image.ImageProducer) class java.awt.FlowLayout (implements java.awt.LayoutManager, java.io.Serializable) class java.awt.event.FocusAdapter (implements java.awt.event.FocusListener) interface java.awt.event.FocusListener (extends java.util.EventListener) class java.awt.Font (implements java.io.Serializable) class java.awt.FontMetrics (implements java.io.Serializable) interface java.awt.peer.FontPeer class java.text.Format (implements java.io.Serializable, java.lang.Cloneable) class java.text.DateFormat (implements java.lang.Cloneable) class java.text.SimpleDateFormat class java.text.MessageFormat class java.text.NumberFormat (implements java.lang.Cloneable) class java.text.ChoiceFormat class java.text.DecimalFormat interface java.awt.peer.FramePeer (extends java.awt.peer.WindowPeer) class java.awt.Graphics class java.awt.GridBagConstraints (implements java.lang.Cloneable, java.io.Serializable) class java.awt.GridBagLayout (implements java.awt.LayoutManager2, java.io.Serializable) class java.awt.GridLayout (implements java.awt.LayoutManager, java.io.Serializable) interface java.security.acl.Group (extends java.security.Principal) class java.security.Identity (implements java.security.Principal, java.io.Serializable) class java.security.IdentityScope class java.security.Signer class java.awt.Image interface java.awt.image.ImageConsumer class java.awt.image.ImageFilter (implements java.awt.image.ImageConsumer, java.lang.Cloneable) class java.awt.image.CropImageFilter class java.awt.image.RGBImageFilter class java.awt.image.ReplicateScaleFilter class java.awt.image.AreaAveragingScaleFilter interface java.awt.image.ImageObserver interface java.awt.image.ImageProducer class java.net.InetAddress (implements java.io.Serializable) class java.util.zip.Inflater class java.io.InputStream class java.io.ByteArrayInputStream class java.io.FileInputStream class java.io.FilterInputStream class java.io.BufferedInputStream class java.util.zip.CheckedInputStream class java.io.DataInputStream (implements java.io.DataInput) class java.security.DigestInputStream class java.util.zip.InflaterInputStream class java.util.zip.GZIPInputStream

ww w. ja

va
285

dil

i.c o

m

286
class java.util.zip.ZipInputStream (implements java.util.zip.ZipConstants) class java.io.LineNumberInputStream class java.io.PushbackInputStream class java.io.ObjectInputStream (implements java.io.ObjectInput, java.io.ObjectStreamConstants) class java.io.PipedInputStream class java.io.SequenceInputStream class java.io.StringBufferInputStream class java.awt.Insets (implements java.lang.Cloneable, java.io.Serializable) class java.beans.Introspector interface java.awt.event.ItemListener (extends java.util.EventListener) interface java.awt.ItemSelectable interface java.security.Key (extends java.io.Serializable) class java.awt.event.KeyAdapter (implements java.awt.event.KeyListener) interface java.awt.event.KeyListener (extends java.util.EventListener) class java.security.KeyPair class java.security.KeyPairGenerator interface java.awt.peer.LabelPeer (extends java.awt.peer.ComponentPeer) interface java.awt.LayoutManager interface java.awt.LayoutManager2 (extends java.awt.LayoutManager) class java.rmi.dgc.Lease (implements java.io.Serializable) interface java.awt.peer.LightweightPeer (extends java.awt.peer.ComponentPeer) interface java.awt.peer.ListPeer (extends java.awt.peer.ComponentPeer) interface java.rmi.server.LoaderHandler class sun.tools.debug.LocalVariable class sun.tools.debug.RemoteStackVariable (implements sun.tools.debug.AgentConstants) class java.util.Locale (implements java.lang.Cloneable, java.io.Serializable) class java.rmi.registry.LocateRegistry class java.lang.Math class java.awt.MediaTracker (implements java.io.Serializable) interface java.lang.reflect.Member class java.awt.image.MemoryImageSource (implements java.awt.image.ImageProducer) interface java.awt.peer.MenuBarPeer (extends java.awt.peer.MenuComponentPeer) class java.awt.MenuComponent (implements java.io.Serializable) class java.awt.MenuBar (implements java.awt.MenuContainer) class java.awt.MenuItem class java.awt.CheckboxMenuItem (implements java.awt.ItemSelectable) class java.awt.Menu (implements java.awt.MenuContainer) class java.awt.PopupMenu interface java.awt.peer.MenuComponentPeer interface java.awt.MenuContainer interface java.awt.peer.MenuItemPeer (extends java.awt.peer.MenuComponentPeer) interface java.awt.peer.MenuPeer (extends java.awt.peer.MenuItemPeer) class java.awt.MenuShortcut (implements java.io.Serializable) class java.security.MessageDigest class java.lang.reflect.Method (implements java.lang.reflect.Member) class java.lang.reflect.Modifier class java.awt.event.MouseAdapter (implements java.awt.event.MouseListener) interface java.awt.event.MouseListener (extends java.util.EventListener) class java.awt.event.MouseMotionAdapter (implements java.awt.event.MouseMotionListener) interface java.awt.event.MouseMotionListener (extends java.util.EventListener) class java.rmi.Naming class java.lang.Number (implements java.io.Serializable) class java.math.BigDecimal class java.math.BigInteger class java.lang.Byte class java.lang.Double class java.lang.Float class java.lang.Integer class java.lang.Long class java.lang.Short class java.rmi.server.ObjID (implements java.io.Serializable) interface java.io.ObjectInput (extends java.io.DataInput) interface java.io.ObjectInputValidation interface java.io.ObjectOutput (extends java.io.DataOutput) class java.io.ObjectStreamClass (implements java.io.Serializable) class java.util.Observable interface java.util.Observer

ww w. ja

va
286

dil

i.c o

m

287
class java.rmi.server.Operation class java.io.OutputStream class java.io.ByteArrayOutputStream class java.io.FileOutputStream class java.io.FilterOutputStream class java.io.BufferedOutputStream class java.util.zip.CheckedOutputStream class java.io.DataOutputStream (implements java.io.DataOutput) class java.util.zip.DeflaterOutputStream class java.util.zip.GZIPOutputStream class java.util.zip.ZipOutputStream (implements java.util.zip.ZipConstants) class java.security.DigestOutputStream class java.io.PrintStream class java.rmi.server.LogStream class java.io.ObjectOutputStream (implements java.io.ObjectOutput, java.io.ObjectStreamConstants) class java.io.PipedOutputStream interface java.security.acl.Owner interface java.awt.peer.PanelPeer (extends java.awt.peer.ContainerPeer) class java.text.ParsePosition interface java.security.acl.Permission class java.awt.image.PixelGrabber (implements java.awt.image.ImageConsumer) class java.awt.Point (implements java.io.Serializable) class java.awt.Polygon (implements java.awt.Shape, java.io.Serializable) interface java.awt.peer.PopupMenuPeer (extends java.awt.peer.MenuPeer) interface java.sql.PreparedStatement (extends java.sql.Statement) interface java.security.Principal interface java.awt.PrintGraphics class java.awt.PrintJob interface java.security.PrivateKey (extends java.security.Key) class java.lang.Process interface java.beans.PropertyChangeListener (extends java.util.EventListener) class java.beans.PropertyChangeSupport (implements java.io.Serializable) interface java.beans.PropertyEditor class java.beans.PropertyEditorManager class java.beans.PropertyEditorSupport (implements java.beans.PropertyEditor) interface java.security.PublicKey (extends java.security.Key) class java.rmi.server.RMIClassLoader interface java.rmi.server.RMIFailureHandler class java.rmi.server.RMISocketFactory class java.util.Random (implements java.io.Serializable) class java.security.SecureRandom class java.io.RandomAccessFile (implements java.io.DataOutput, java.io.DataInput) class java.io.Reader class java.io.BufferedReader class java.io.LineNumberReader class java.io.CharArrayReader class java.io.FilterReader class java.io.PushbackReader class java.io.InputStreamReader class java.io.FileReader class java.io.PipedReader class java.io.StringReader class java.awt.Rectangle (implements java.awt.Shape, java.io.Serializable) interface java.rmi.registry.Registry (extends java.rmi.Remote) interface java.rmi.registry.RegistryHandler interface java.rmi.Remote interface java.rmi.server.RemoteCall class sun.tools.debug.RemoteDebugger class java.rmi.server.RemoteObject (implements java.rmi.Remote, java.io.Serializable) class java.rmi.server.RemoteServer class java.rmi.server.UnicastRemoteObject class java.rmi.server.RemoteStub interface java.rmi.server.RemoteRef (extends java.io.Externalizable) class sun.tools.debug.RemoteValue (implements sun.tools.debug.AgentConstants) class sun.tools.debug.RemoteBoolean class sun.tools.debug.RemoteByte class sun.tools.debug.RemoteChar

ww w. ja

va
287

dil

i.c o

m

288
class sun.tools.debug.RemoteDouble class sun.tools.debug.RemoteFloat class sun.tools.debug.RemoteInt class sun.tools.debug.RemoteLong class sun.tools.debug.RemoteObject class sun.tools.debug.RemoteArray class sun.tools.debug.RemoteClass class sun.tools.debug.RemoteString class sun.tools.debug.RemoteThread class sun.tools.debug.RemoteThreadGroup class sun.tools.debug.RemoteShort class java.util.ResourceBundle class java.util.ListResourceBundle class java.util.PropertyResourceBundle interface java.sql.ResultSet interface java.sql.ResultSetMetaData interface java.lang.Runnable class java.lang.Runtime interface java.awt.peer.ScrollPanePeer (extends java.awt.peer.ContainerPeer) interface java.awt.peer.ScrollbarPeer (extends java.awt.peer.ComponentPeer) class java.security.Security class java.lang.SecurityManager class java.rmi.RMISecurityManager interface java.io.Serializable interface sunw.io.Serializable (extends java.io.Serializable) interface java.rmi.server.ServerRef (extends java.rmi.server.RemoteRef) class java.net.ServerSocket interface java.awt.Shape class java.security.Signature class java.beans.SimpleBeanInfo (implements java.beans.BeanInfo) interface java.rmi.server.Skeleton class java.net.Socket class java.net.SocketImpl (implements java.net.SocketOptions) interface java.net.SocketImplFactory class sun.tools.debug.StackFrame class sun.tools.debug.RemoteStackFrame interface java.sql.Statement class java.io.StreamTokenizer class java.lang.String (implements java.io.Serializable) class java.lang.StringBuffer (implements java.io.Serializable) class java.text.StringCharacterIterator (implements java.text.CharacterIterator) class java.awt.datatransfer.StringSelection (implements java.awt.datatransfer.Transferable, java.awt.datatransfer.ClipboardOwner) class java.util.StringTokenizer (implements java.util.Enumeration) class java.lang.System interface java.awt.peer.TextAreaPeer (extends java.awt.peer.TextComponentPeer) interface java.awt.peer.TextComponentPeer (extends java.awt.peer.ComponentPeer) interface java.awt.peer.TextFieldPeer (extends java.awt.peer.TextComponentPeer) interface java.awt.event.TextListener (extends java.util.EventListener) class java.lang.Thread (implements java.lang.Runnable) class java.lang.ThreadGroup class java.lang.Throwable (implements java.io.Serializable) class java.lang.Error class java.awt.AWTError class java.lang.LinkageError class java.lang.ClassCircularityError class java.lang.ClassFormatError class java.lang.ExceptionInInitializerError class java.lang.IncompatibleClassChangeError class java.lang.AbstractMethodError class java.lang.IllegalAccessError class java.lang.InstantiationError class java.lang.NoSuchFieldError class java.lang.NoSuchMethodError class java.lang.NoClassDefFoundError class java.lang.UnsatisfiedLinkError class java.lang.VerifyError

ww w. ja

va
288

dil

i.c o

m

289
class java.lang.ThreadDeath class java.lang.VirtualMachineError class java.lang.InternalError class java.lang.OutOfMemoryError class java.lang.StackOverflowError class java.lang.UnknownError class java.lang.Exception class java.awt.AWTException class java.security.acl.AclNotFoundException class java.rmi.AlreadyBoundException class java.lang.ClassNotFoundException class java.lang.CloneNotSupportedException class java.rmi.server.ServerCloneException class java.util.zip.DataFormatException class java.security.DigestException class java.io.IOException class java.io.CharConversionException class java.io.EOFException class java.io.FileNotFoundException class java.io.InterruptedIOException class java.net.MalformedURLException class java.io.ObjectStreamException class java.io.InvalidClassException class java.io.InvalidObjectException class java.io.NotActiveException class java.io.NotSerializableException class java.io.OptionalDataException class java.io.StreamCorruptedException class java.io.WriteAbortedException class java.net.ProtocolException class java.rmi.RemoteException class java.rmi.AccessException class java.rmi.ConnectException class java.rmi.ConnectIOException class java.rmi.server.ExportException class java.rmi.server.SocketSecurityException class java.rmi.MarshalException class java.rmi.NoSuchObjectException class java.rmi.ServerError class java.rmi.ServerException class java.rmi.ServerRuntimeException class java.rmi.server.SkeletonMismatchException class java.rmi.server.SkeletonNotFoundException class java.rmi.StubNotFoundException class java.rmi.UnexpectedException class java.rmi.UnknownHostException class java.rmi.UnmarshalException class java.net.SocketException class java.net.BindException class java.net.ConnectException class java.net.NoRouteToHostException class java.io.SyncFailedException class java.io.UTFDataFormatException class java.net.UnknownHostException class java.net.UnknownServiceException class java.io.UnsupportedEncodingException class java.util.zip.ZipException class java.lang.IllegalAccessException class java.lang.InstantiationException class java.lang.InterruptedException class java.beans.IntrospectionException class java.lang.reflect.InvocationTargetException class java.security.KeyException class java.security.InvalidKeyException class java.security.KeyManagementException class java.security.acl.LastOwnerException class sun.tools.debug.NoSessionException

ww w. ja

va
289

dil

i.c o

m

290
class java.security.NoSuchAlgorithmException class java.lang.NoSuchFieldException class sun.tools.debug.NoSuchLineNumberException class java.lang.NoSuchMethodException class java.security.NoSuchProviderException class java.rmi.NotBoundException class java.security.acl.NotOwnerException class java.text.ParseException class java.beans.PropertyVetoException class java.lang.RuntimeException class java.lang.ArithmeticException class java.lang.ArrayStoreException class java.lang.ClassCastException class java.util.EmptyStackException class java.lang.IllegalArgumentException class java.text.FormatException class java.lang.IllegalThreadStateException class java.security.InvalidParameterException class java.lang.NumberFormatException class java.lang.IllegalMonitorStateException class java.lang.IllegalStateException class java.awt.IllegalComponentStateException class java.lang.IndexOutOfBoundsException class java.lang.ArrayIndexOutOfBoundsException class java.lang.StringIndexOutOfBoundsException class java.util.MissingResourceException class java.lang.NegativeArraySizeException class java.util.NoSuchElementException class java.lang.NullPointerException class java.security.ProviderException class java.lang.SecurityException class java.rmi.RMISecurityException class java.sql.SQLException class java.sql.SQLWarning class java.sql.DataTruncation class java.rmi.server.ServerNotActiveException class java.security.SignatureException class java.util.TooManyListenersException class java.awt.datatransfer.UnsupportedFlavorException class java.util.TimeZone (implements java.io.Serializable, java.lang.Cloneable) class java.util.SimpleTimeZone class java.awt.Toolkit interface java.awt.datatransfer.Transferable class java.sql.Types class java.rmi.server.UID (implements java.io.Serializable) class java.net.URL (implements java.io.Serializable) class java.net.URLConnection class java.net.HttpURLConnection class java.net.URLEncoder class java.net.URLStreamHandler interface java.net.URLStreamHandlerFactory interface java.rmi.server.Unreferenced class java.rmi.dgc.VMID (implements java.io.Serializable) class java.util.Vector (implements java.lang.Cloneable, java.io.Serializable) class java.util.Stack interface java.beans.VetoableChangeListener (extends java.util.EventListener) class java.beans.VetoableChangeSupport (implements java.io.Serializable) interface java.beans.Visibility class java.lang.Void class java.awt.event.WindowAdapter (implements java.awt.event.WindowListener) interface java.awt.event.WindowListener (extends java.util.EventListener) interface java.awt.peer.WindowPeer (extends java.awt.peer.ContainerPeer) class java.io.Writer class java.io.BufferedWriter class java.io.CharArrayWriter class java.io.FilterWriter class java.io.OutputStreamWriter

ww w. ja

va
290

dil

i.c o

m

291

Not : Bu liste ingilizce açıklamalarıyla verilmiştir. Listenin Türkçesi hazırlanacaktır.
A

ww w. ja

a. Variable in class java.awt.AWTEventMulticaster ABORT. Static variable in interface java.awt.image.ImageObserver An image which was being tracked asynchronously was aborted before production was complete. ABORTED. Static variable in class java.awt.MediaTracker Flag indicating the download of some media was aborted. abortGrabbing(). Method in class java.awt.image.PixelGrabber Request the PixelGrabber to abort the image fetch. abs(). Method in class java.math.BigDecimal Returns a BigDecimal whose value is the absolute value of this number, and whose scale is this.scale(). abs(). Method in class java.math.BigInteger Returns a BigInteger whose value is the absolute value of this number. abs(double). Static method in class java.lang.Math Returns the absolute value of a double value. abs(float). Static method in class java.lang.Math Returns the absolute value of a float value. abs(int). Static method in class java.lang.Math Returns the absolute value of an int value. abs(long). Static method in class java.lang.Math Returns the absolute value of a long value. ABSTRACT. Static variable in class java.lang.reflect.Modifier AbstractMethodError(). Constructor for class java.lang.AbstractMethodError Constructs an AbstractMethodError with no detail message. AbstractMethodError(String). Constructor for class java.lang.AbstractMethodError Constructs an AbstractMethodError with the specified detail message. accept(). Method in class java.net.ServerSocket Listens for a connection to be made to this socket and accepts it. accept(File, String). Method in interface java.io.FilenameFilter Tests if a specified file should be included in a file list. accept(SocketImpl). Method in class java.net.SocketImpl Accepts a connection. acceptsURL(String). Method in interface java.sql.Driver Returns true if the driver thinks that it can open a connection to the given URL. AccessException(String). Constructor for class java.rmi.AccessException Create a new AccessException with a description. AccessException(String, Exception). Constructor for class java.rmi.AccessException Create a new AccessException with a description and detail exception. AclNotFoundException(). Constructor for class java.security.acl.AclNotFoundException Constructs an AclNotFoundException. acos(double). Static method in class java.lang.Math Returns the arc cosine of an angle, in the range of 0.0 through pi. action(Event, Object). Method in class java.awt.Component ACTION_EVENT. Static variable in class java.awt.Event An action event. ACTION_EVENT_MASK. Static variable in class java.awt.AWTEvent The event mask for selecting action events. ACTION_FIRST. Static variable in class java.awt.event.ActionEvent Marks the first integer id for the range of action event ids. ACTION_LAST. Static variable in class java.awt.event.ActionEvent Marks the last integer id for the range of action event ids. ACTION_PERFORMED. Static variable in class java.awt.event.ActionEvent An action performed event type. ActionEvent(Object, int, String). Constructor for class java.awt.event.ActionEvent Constructs an ActionEvent object with the specified source object. ActionEvent(Object, int, String, int). Constructor for class java.awt.event.ActionEvent Constructs an ActionEvent object with the specified source object. actionPerformed(ActionEvent). Method in interface java.awt.event.ActionListener Invoked when an action occurs. actionPerformed(ActionEvent). Method in class java.awt.AWTEventMulticaster Handles the actionPerformed event by invoking the actionPerformed methods on listener-a and listener-b. ACTIVE_CAPTION. Static variable in class java.awt.SystemColor The array index for the active caption background color. ACTIVE_CAPTION_BORDER. Static variable in class java.awt.SystemColor The array index for the active caption border color. ACTIVE_CAPTION_TEXT. Static variable in class java.awt.SystemColor The array index for the action caption text color. activeCaption. Static variable in class java.awt.SystemColor The background color for captions in window borders.

va
291

dil

i.c o

m

EK C JAVADA KULLANILAN METODLARIN LİSTESİ

292
activeCaptionBorder. Static variable in class java.awt.SystemColor The border color for captions in window borders. activeCaptionText. Static variable in class java.awt.SystemColor The text color for captions in window borders. activeCount(). Static method in class java.lang.Thread Returns the current number of active threads in this thread group. activeCount(). Method in class java.lang.ThreadGroup Returns an estimate of the number of active threads in this thread group. activeGroupCount(). Method in class java.lang.ThreadGroup Returns an estimate of the number of active groups in this thread group. AD. Static variable in class java.util.GregorianCalendar Useful constant for GregorianCalendar. add(ActionListener, ActionListener). Static method in class java.awt.AWTEventMulticaster Adds action-listener-a with action-listener-b and returns the resulting multicast listener. add(AdjustmentListener, AdjustmentListener). Static method in class java.awt.AWTEventMulticaster Adds adjustment-listener-a with adjustment-listener-b and returns the resulting multicast listener. add(BigDecimal). Method in class java.math.BigDecimal Returns a BigDecimal whose value is (this + val), and whose scale is MAX(this.scale(), val.scale). add(BigInteger). Method in class java.math.BigInteger Returns a BigInteger whose value is (this + val). add(Component). Method in class java.awt.Container Adds the specified component to this container. add(Component, int). Method in class java.awt.Container Adds the specified component to this container at the given position in the container's component list. add(Component, Object). Method in class java.awt.Container Adds the specified component to this container at the specified index. add(Component, Object, int). Method in class java.awt.Container Adds the specified component to this container with the specified constraints at the specified index. add(ComponentListener, ComponentListener). Static method in class java.awt.AWTEventMulticaster Adds component-listener-a with component-listener-b and returns the resulting multicast listener. add(ContainerListener, ContainerListener). Static method in class java.awt.AWTEventMulticaster Adds container-listener-a with container-listener-b and returns the resulting multicast listener. add(FocusListener, FocusListener). Static method in class java.awt.AWTEventMulticaster Adds focus-listener-a with focus-listener-b and returns the resulting multicast listener. add(int, int). Method in class java.util.Calendar Date Arithmetic function. add(int, int). Method in class java.util.GregorianCalendar Overrides Calendar Date Arithmetic function. add(int, int). Method in class java.awt.Rectangle Adds a point to a rectangle. add(ItemListener, ItemListener). Static method in class java.awt.AWTEventMulticaster Adds item-listener-a with item-listener-b and returns the resulting multicast listener. add(KeyListener, KeyListener). Static method in class java.awt.AWTEventMulticaster Adds key-listener-a with key-listener-b and returns the resulting multicast listener. add(Menu). Method in class java.awt.MenuBar Adds the specified menu to the menu bar. add(MenuItem). Method in class java.awt.Menu Adds the specified item to this menu. add(MouseListener, MouseListener). Static method in class java.awt.AWTEventMulticaster Adds mouse-listener-a with mouse-listener-b and returns the resulting multicast listener. add(MouseMotionListener, MouseMotionListener). Static method in class java.awt.AWTEventMulticaster Adds mouse-motion-listener-a with mouse-motion-listener-b and returns the resulting multicast listener. add(Point). Method in class java.awt.Rectangle Adds a point to a rectangle. add(PopupMenu). Method in class java.awt.Component Adds the specified popup menu to the component. add(Rectangle). Method in class java.awt.Rectangle Adds a rectangle to a rectangle. add(String). Method in class java.awt.Choice Adds an item to this Choice. add(String). Method in class java.awt.List Adds the specified item to the end of scrolling list. add(String). Method in class java.awt.Menu Adds an item with with the specified label to this menu. add(String, Component). Method in class java.awt.Container Adds the specified component to this container. add(String, int). Method in interface java.awt.peer.ChoicePeer add(String, int). Method in class java.awt.List Adds the specified item to the scrolling list at the specified position. add(String, int). Method in interface java.awt.peer.ListPeer add(TextListener, TextListener). Static method in class java.awt.AWTEventMulticaster add(WindowListener, WindowListener). Static method in class java.awt.AWTEventMulticaster Adds window-listener-a with window-listener-b and returns the resulting multicast listener. addActionListener(ActionListener). Method in class java.awt.Button Adds the specified action listener to receive action events from this button. addActionListener(ActionListener). Method in class java.awt.List

ww w. ja

va
292

dil

i.c o

m

293
Adds the specified action listener to receive action events from this list. addActionListener(ActionListener). Method in class java.awt.MenuItem Adds the specified action listener to receive action events from this menu item. addActionListener(ActionListener). Method in class java.awt.TextField Adds the specified action listener to recieve action events from this textfield. addAdjustmentListener(AdjustmentListener). Method in interface java.awt.Adjustable Add a listener to recieve adjustment events when the value of the adjustable object changes. addAdjustmentListener(AdjustmentListener). Method in class java.awt.Scrollbar Adds the specified adjustment listener to recieve adjustment events from this scrollbar. addCertificate(Certificate). Method in class java.security.Identity Adds a certificate for this identity. addComponentListener(ComponentListener). Method in class java.awt.Component Adds the specified component listener to receive component events from this component. addConsumer(ImageConsumer). Method in class java.awt.image.FilteredImageSource Adds an ImageConsumer to the list of consumers interested in data for this image. addConsumer(ImageConsumer). Method in interface java.awt.image.ImageProducer This method is used to register an ImageConsumer with the ImageProducer for access to the image data during a later reconstruction of the Image. addConsumer(ImageConsumer). Method in class java.awt.image.MemoryImageSource Adds an ImageConsumer to the list of consumers interested in data for this image. addContainerListener(ContainerListener). Method in class java.awt.Container Adds the specified container listener to receive container events from this container. addElement(Object). Method in class java.util.Vector Adds the specified component to the end of this vector, increasing its size by one. addEntry(Principal, AclEntry). Method in interface java.security.acl.Acl Adds an ACL entry to this ACL. addFocusListener(FocusListener). Method in class java.awt.Component Adds the specified focus listener to receive focus events from this component. addHelpMenu(Menu). Method in interface java.awt.peer.MenuBarPeer addIdentity(Identity). Method in class java.security.IdentityScope Adds an identity to this identity scope. addImage(Image, int). Method in class java.awt.MediaTracker Adds an image to the list of images being tracked. addImage(Image, int, int, int). Method in class java.awt.MediaTracker Adds a scaled image to the list of images being tracked. addImpl(Component, Object, int). Method in class java.awt.Container Adds the specified component to this container at the specified index. addImpl(Component, Object, int). Method in class java.awt.ScrollPane Adds the specified component to this scroll pane container. addInternal(EventListener, EventListener). Static method in class java.awt.AWTEventMulticaster Returns the resulting multicast listener from adding listener-a and listener-b together. addItem(MenuItem). Method in interface java.awt.peer.MenuPeer addItem(String). Method in class java.awt.Choice Adds an item to this Choice. addItem(String). Method in class java.awt.List Adds the specified item to the end of scrolling list. addItem(String, int). Method in interface java.awt.peer.ChoicePeer addItem(String, int). Method in class java.awt.List Adds the specified item to the scrolling list at the specified position. addItem(String, int). Method in interface java.awt.peer.ListPeer DEPRECATED: Replaced by add(String, int). addItemListener(ItemListener). Method in class java.awt.Checkbox Adds the specified item listener to recieve item events from this checkbox. addItemListener(ItemListener). Method in class java.awt.CheckboxMenuItem Adds the specified item listener to recieve item events from this checkbox menu item. addItemListener(ItemListener). Method in class java.awt.Choice Adds the specified item listener to recieve item events from this choice. addItemListener(ItemListener). Method in interface java.awt.ItemSelectable Add a listener to recieve item events when the state of an item changes. addItemListener(ItemListener). Method in class java.awt.List Adds the specified item listener to recieve item events from this list. addKeyListener(KeyListener). Method in class java.awt.Component Adds the specified key listener to receive key events from this component. addLayoutComponent(Component, Object). Method in class java.awt.BorderLayout Adds the specified component to the layout, using the specified constraint object. addLayoutComponent(Component, Object). Method in class java.awt.CardLayout Adds the specified component to the layout, using the specified constraint object. addLayoutComponent(Component, Object). Method in class java.awt.GridBagLayout Adds the specified component to the layout, using the specified constraint object. addLayoutComponent(Component, Object). Method in interface java.awt.LayoutManager2 Adds the specified component to the layout, using the specified constraint object. addLayoutComponent(String, Component). Method in class java.awt.BorderLayout Replaced by addLayoutComponent(Component, Object). addLayoutComponent(String, Component). Method in class java.awt.CardLayout Replaced by addLayoutComponent(Component, Object). addLayoutComponent(String, Component). Method in class java.awt.FlowLayout

ww w. ja

va
293

dil

i.c o

m

294
Adds the specified component to the layout. addLayoutComponent(String, Component). Method in class java.awt.GridBagLayout Adds the specified component with the specified name to the layout. addLayoutComponent(String, Component). Method in class java.awt.GridLayout Adds the specified component with the specified name to the layout. addLayoutComponent(String, Component). Method in interface java.awt.LayoutManager Adds the specified component with the specified name to the layout. addMember(Principal). Method in interface java.security.acl.Group Adds the specified member to the group. addMenu(Menu). Method in interface java.awt.peer.MenuBarPeer addMouseListener(MouseListener). Method in class java.awt.Component Adds the specified mouse listener to receive mouse events from this component. addMouseMotionListener(MouseMotionListener). Method in class java.awt.Component Adds the specified mouse motion listener to receive mouse motion events from this component. addNotify(). Method in class java.awt.Button Creates the peer of the button. addNotify(). Method in class java.awt.Canvas Creates the peer of the canvas. addNotify(). Method in class java.awt.Checkbox Creates the peer of the Checkbox. addNotify(). Method in class java.awt.CheckboxMenuItem Creates the peer of the checkbox item. addNotify(). Method in class java.awt.Choice Creates the Choice's peer. addNotify(). Method in class java.awt.Component Notifies the Component that it has been added to a container and if a peer is required, it should be created. addNotify(). Method in class java.awt.Container Notifies the container to create a peer. addNotify(). Method in class java.awt.Dialog Creates the frame's peer. addNotify(). Method in class java.awt.FileDialog Creates the file dialog's peer. addNotify(). Method in class java.awt.Frame Creates the Frame's peer. addNotify(). Method in class java.awt.Label Creates the peer for this label. addNotify(). Method in class java.awt.List Creates the peer for the list. addNotify(). Method in class java.awt.Menu Creates the menu's peer. addNotify(). Method in class java.awt.MenuBar Creates the menu bar's peer. addNotify(). Method in class java.awt.MenuItem Creates the menu item's peer. addNotify(). Method in class java.awt.Panel Creates the Panel's peer. addNotify(). Method in class java.awt.PopupMenu Creates the popup menu's peer. addNotify(). Method in class java.awt.Scrollbar Creates the Scrollbar's peer. addNotify(). Method in class java.awt.ScrollPane Creates the scroll pane's peer. addNotify(). Method in class java.awt.TextArea Creates the TextArea's peer. addNotify(). Method in class java.awt.TextField Creates the TextField's peer. addNotify(). Method in class java.awt.Window Creates the Window's peer. addObserver(Observer). Method in class java.util.Observable Adds an observer to the set of observers for this object. addOwner(Principal, Principal). Method in interface java.security.acl.Owner Adds an owner. addPermission(Permission). Method in interface java.security.acl.AclEntry Adds the specified permission to this ACL entry. addPoint(int, int). Method in class java.awt.Polygon Appends a point to a polygon. addPropertyChangeListener(PropertyChangeListener). Method in interface java.beans.Customizer Register a listener for the PropertyChange event. addPropertyChangeListener(PropertyChangeListener). Method in class java.beans.PropertyChangeSupport Add a PropertyChangeListener to the listener list. addPropertyChangeListener(PropertyChangeListener). Method in interface java.beans.PropertyEditor Register a listener for the PropertyChange event. addPropertyChangeListener(PropertyChangeListener). Method in class java.beans.PropertyEditorSupport Register a listener for the PropertyChange event. addProvider(Provider). Static method in class java.security.Security Adds a provider to the next position available.

ww w. ja

va
294

dil

i.c o

m

295
address. Variable in class java.net.SocketImpl The IP address of the remote end of this socket. addSeparator(). Method in class java.awt.Menu Adds a separator line, or a hypen, to the menu at the current position. addSeparator(). Method in interface java.awt.peer.MenuPeer addSystemThread(). Method in class sun.tools.debug.RemoteDebugger Add the calling thread to the list of threads which aren't suspended by the RemoteDebugger. addSystemThread(Thread). Method in class sun.tools.debug.RemoteDebugger Add the specified thread to the list of threads which aren't suspended by the RemoteDebugger. addTextListener(TextListener). Method in class java.awt.TextComponent Adds the specified text event listener to recieve text events from this textcomponent. addVetoableChangeListener(VetoableChangeListener). Method in class java.beans.VetoableChangeSupport Add a VetoableListener to the listener list. addWindowListener(WindowListener). Method in class java.awt.Window Adds the specified window listener to receive window events from this window. AdjustForGravity(GridBagConstraints, Rectangle). Method in class java.awt.GridBagLayout ADJUSTMENT_EVENT_MASK. Static variable in class java.awt.AWTEvent The event mask for selecting adjustment events. ADJUSTMENT_FIRST. Static variable in class java.awt.event.AdjustmentEvent Marks the first integer id for the range of adjustment event ids. ADJUSTMENT_LAST. Static variable in class java.awt.event.AdjustmentEvent Marks the last integer id for the range of adjustment event ids. ADJUSTMENT_VALUE_CHANGED. Static variable in class java.awt.event.AdjustmentEvent The adjustment value changed event. AdjustmentEvent(Adjustable, int, int, int). Constructor for class java.awt.event.AdjustmentEvent Constructs a AdjustmentEvent object with the specified Adjustable source, type, and value. adjustmentValueChanged(AdjustmentEvent). Method in interface java.awt.event.AdjustmentListener Invoked when the value of the adjustable has changed. adjustmentValueChanged(AdjustmentEvent). Method in class java.awt.AWTEventMulticaster Handles the adjustmentValueChanged event by invoking the adjustmentValueChanged methods on listener-a and listener-b. Adler32(). Constructor for class java.util.zip.Adler32 after(Date). Method in class java.util.Date Tests if this date is after the specified date. after(Object). Method in class java.util.Calendar Compares the time field records. after(Object). Method in class java.util.GregorianCalendar Overrides Calendar Compares the time field records. after(Timestamp). Method in class java.sql.Timestamp Is this timestamp later than the timestamp argument? ALLBITS. Static variable in interface java.awt.image.ImageObserver A static image which was previously drawn is now complete and can be drawn again in its final form. allowsMultipleSelections(). Method in class java.awt.List allowThreadSuspension(boolean). Method in class java.lang.ThreadGroup Used by VM to control lowmem implicit suspension. allowUserInteraction. Variable in class java.net.URLConnection If true, this URL is being examined in a context in which it makes sense to allow user interactions such as popping up an authentication dialog. allProceduresAreCallable(). Method in interface java.sql.DatabaseMetaData Can all the procedures returned by getProcedures be called by the current user? allTablesAreSelectable(). Method in interface java.sql.DatabaseMetaData Can all the tables returned by getTable be SELECTed by the current user? AlreadyBoundException(). Constructor for class java.rmi.AlreadyBoundException AlreadyBoundException(String). Constructor for class java.rmi.AlreadyBoundException ALT_MASK. Static variable in class java.awt.event.ActionEvent The alt modifier constant. ALT_MASK. Static variable in class java.awt.Event The alt modifier constant. ALT_MASK. Static variable in class java.awt.event.InputEvent The alt key modifier constant. AM. Static variable in class java.util.Calendar Useful constant for hour in 12-hour clock. AM_PM. Static variable in class java.util.Calendar Useful constant for date and time. AM_PM_FIELD. Static variable in class java.text.DateFormat Useful constant for AM_PM field alignment. anchor. Variable in class java.awt.GridBagConstraints and(BigInteger). Method in class java.math.BigInteger Returns a BigInteger whose value is (this & val). and(BitSet). Method in class java.util.BitSet Performs a logical AND of this target bit set with the argument bit set. andNot(BigInteger). Method in class java.math.BigInteger Returns a BigInteger whose value is (this & ~val). annotateClass(Class). Method in class java.io.ObjectOutputStream Subclasses may implement this method to allow class data to be stored in the stream. append(boolean). Method in class java.lang.StringBuffer Appends the string representation of the boolean argument to the string buffer.

ww w. ja

va
295

dil

i.c o

m

296
append(char). Method in class java.lang.StringBuffer Appends the string representation of the char argument to this string buffer. append(char[]). Method in class java.lang.StringBuffer Appends the string representation of the char array argument to this string buffer. append(char[], int, int). Method in class java.lang.StringBuffer Appends the string representation of a subarray of the char array argument to this string buffer. append(double). Method in class java.lang.StringBuffer Appends the string representation of the double argument to this string buffer. append(float). Method in class java.lang.StringBuffer Appends the string representation of the float argument to this string buffer. append(int). Method in class java.lang.StringBuffer Appends the string representation of the int argument to this string buffer. append(long). Method in class java.lang.StringBuffer Appends the string representation of the long argument to this string buffer. append(Object). Method in class java.lang.StringBuffer Appends the string representation of the Object argument to this string buffer. append(String). Method in class java.lang.StringBuffer Appends the string to this string buffer. append(String). Method in class java.awt.TextArea Appends the given text to the end. appendText(String). Method in class java.awt.TextArea Applet(). Constructor for class java.applet.Applet appletResize(int, int). Method in interface java.applet.AppletStub Called when the applet wants to be resized. applyLocalizedPattern(String). Method in class java.text.DecimalFormat Apply the given pattern to this Format object. applyLocalizedPattern(String). Method in class java.text.SimpleDateFormat Apply the given localized pattern string to this date format. applyPattern(String). Method in class java.text.ChoiceFormat Sets the pattern. applyPattern(String). Method in class java.text.DecimalFormat Apply the given pattern to this Format object. applyPattern(String). Method in class java.text.MessageFormat Sets the pattern. applyPattern(String). Method in class java.text.SimpleDateFormat Apply the given unlocalized pattern string to this date format. APRIL. Static variable in class java.util.Calendar Useful constant for month. AreaAveragingScaleFilter(int, int). Constructor for class java.awt.image.AreaAveragingScaleFilter Constructs an AreaAveragingScaleFilter that scales the pixels from its source Image as specified by the width and height parameters. areFieldsSet. Variable in class java.util.Calendar The flag which tells if the time fields are set for the calendar. arg. Variable in class java.awt.Event An arbitrary argument. ArithmeticException(). Constructor for class java.lang.ArithmeticException Constructs an ArithmeticException with no detail message. ArithmeticException(String). Constructor for class java.lang.ArithmeticException Constructs an ArithmeticException with the specified detail message. ArrangeGrid(Container). Method in class java.awt.GridBagLayout arraycopy(Object, int, Object, int, int). Static method in class java.lang.System Copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array. ArrayIndexOutOfBoundsException(). Constructor for class java.lang.ArrayIndexOutOfBoundsException Constructs an ArrayIndexOutOfBoundsException with no detail message. ArrayIndexOutOfBoundsException(int). Constructor for class java.lang.ArrayIndexOutOfBoundsException Constructs a new ArrayIndexOutOfBoundsException class with an argument indicating the illegal index. ArrayIndexOutOfBoundsException(String). Constructor for class java.lang.ArrayIndexOutOfBoundsException Constructs an ArrayIndexOutOfBoundsException class with the specified detail message. ArrayStoreException(). Constructor for class java.lang.ArrayStoreException Constructs an ArrayStoreException with no detail message. ArrayStoreException(String). Constructor for class java.lang.ArrayStoreException Constructs an ArrayStoreException with the specified detail message. arrayTypeName(int). Method in class sun.tools.debug.RemoteArray Return the element type as a string. asin(double). Static method in class java.lang.Math Returns the arc sine of an angle, in the range of -pi/2 through pi/2. atan(double). Static method in class java.lang.Math Returns the arc tangent of an angle, in the range of -pi/2 through pi/2. atan2(double, double). Static method in class java.lang.Math Converts rectangular coordinates (b, a) to polar (r, theta). attributeNames(). Method in class java.beans.FeatureDescriptor AUGUST. Static variable in class java.util.Calendar Useful constant for month. available(). Method in class java.io.BufferedInputStream Returns the number of bytes that can be read from this input stream without blocking.

ww w. ja

va
296

dil

i.c o

m

297
available(). Method in class java.io.ByteArrayInputStream Returns the number of bytes that can be read from this input stream without blocking. available(). Method in class java.io.FileInputStream Returns the number of bytes that can be read from this file input stream without blocking. available(). Method in class java.io.FilterInputStream Returns the number of bytes that can be read from this input stream without blocking. available(). Method in class java.io.InputStream Returns the number of bytes that can be read from this input stream without blocking. available(). Method in class java.io.LineNumberInputStream Returns the number of bytes that can be read from this input stream without blocking. available(). Method in interface java.io.ObjectInput Returns the number of bytes that can be read without blocking. available(). Method in class java.io.ObjectInputStream Returns the number of bytes that can be read without blocking. available(). Method in class java.io.PipedInputStream Returns the number of bytes that can be read from this input stream without blocking. available(). Method in class java.io.PushbackInputStream Returns the number of bytes that can be read from this input stream without blocking. available(). Method in class java.io.SequenceInputStream Returns the number of bytes available on the current stream. available(). Method in class java.net.SocketImpl Returns the number of bytes that can be read from this socket without blocking. available(). Method in class java.io.StringBufferInputStream Returns the number of bytes that can be read from the input stream without blocking. avoidingGui(). Method in interface java.beans.Visibility AWTError(String). Constructor for class java.awt.AWTError AWTEvent(Event). Constructor for class java.awt.AWTEvent Constructs an AWTEvent object from the parameters of a 1.0-style event. AWTEvent(Object, int). Constructor for class java.awt.AWTEvent Constructs an AWTEvent object with the specified source object and type. AWTEventMulticaster(EventListener, EventListener). Constructor for class java.awt.AWTEventMulticaster Creates an event multicaster instance which chains listener-a with listener-b. AWTException(String). Constructor for class java.awt.AWTException Constructs an AWTException with the specified detail message.

B

ww w. ja

b. Variable in class java.awt.AWTEventMulticaster BACK_SPACE. Static variable in class java.awt.Event The BackSpace key. BC. Static variable in class java.util.GregorianCalendar Useful constant for GregorianCalendar. BeanDescriptor(Class). Constructor for class java.beans.BeanDescriptor Create a BeanDescriptor for a bean that doesn't have a customizer. BeanDescriptor(Class, Class). Constructor for class java.beans.BeanDescriptor Create a BeanDescriptor for a bean that has a customizer. Beans(). Constructor for class java.beans.Beans beep(). Method in class java.awt.Toolkit Emits an audio beep. before(Date). Method in class java.util.Date Tests if this date is before the specified date. before(Object). Method in class java.util.Calendar Compares the time field records. before(Object). Method in class java.util.GregorianCalendar Overrides Calendar Compares the time field records. before(Timestamp). Method in class java.sql.Timestamp Is this timestamp earlier than the timestamp argument? beginValidate(). Method in interface java.awt.peer.ContainerPeer BEST_COMPRESSION. Static variable in class java.util.zip.Deflater Compression level for best compression. BEST_SPEED. Static variable in class java.util.zip.Deflater Compression level for fastest compression. bestRowNotPseudo. Static variable in interface java.sql.DatabaseMetaData BEST ROW PSEUDO_COLUMN - is NOT a pseudo column. bestRowPseudo. Static variable in interface java.sql.DatabaseMetaData BEST ROW PSEUDO_COLUMN - is a pseudo column. bestRowSession. Static variable in interface java.sql.DatabaseMetaData BEST ROW SCOPE - valid for remainder of current session. bestRowTemporary. Static variable in interface java.sql.DatabaseMetaData BEST ROW SCOPE - very temporary, while using row. bestRowTransaction. Static variable in interface java.sql.DatabaseMetaData BEST ROW SCOPE - valid for remainder of current transaction. bestRowUnknown. Static variable in interface java.sql.DatabaseMetaData BEST ROW PSEUDO_COLUMN - may or may not be pseudo column.

va
297

dil

i.c o

m

298
BigDecimal(BigInteger). Constructor for class java.math.BigDecimal Translates a BigInteger into a BigDecimal. BigDecimal(BigInteger, int). Constructor for class java.math.BigDecimal Translates a BigInteger and a scale into a BigDecimal. BigDecimal(double). Constructor for class java.math.BigDecimal Translates a double into a BigDecimal. BigDecimal(String). Constructor for class java.math.BigDecimal Constructs a BigDecimal from a string containing an optional minus sign followed by a sequence of zero or more decimal digits, optionally followed by a fraction, which consists of a decimal point followed by zero or more decimal digits. BIGINT. Static variable in class java.sql.Types BigInteger(byte[]). Constructor for class java.math.BigInteger Translates a byte array containing the two's-complement representation of a (signed) integer into a BigInteger. BigInteger(int, byte[]). Constructor for class java.math.BigInteger Translates the sign-magnitude representation of an integer into a BigInteger. BigInteger(int, int, Random). Constructor for class java.math.BigInteger Returns a randomly selected BigInteger with the specified bitLength that is probably prime. BigInteger(int, Random). Constructor for class java.math.BigInteger Returns a random number uniformly distributed on [0, 2**numBits - 1] (assuming a fair source of random bits is provided in rndSrc). BigInteger(String). Constructor for class java.math.BigInteger Translates a string containing an optional minus sign followed by a sequence of one or more decimal digits into a BigInteger. BigInteger(String, int). Constructor for class java.math.BigInteger Translates a string containing an optional minus sign followed by a sequence of one or more digits in the specified radix into a BigInteger. BINARY. Static variable in class java.sql.Types bind(InetAddress, int). Method in class java.net.SocketImpl Binds this socket to the specified port number on the specified host. bind(int, InetAddress). Method in class java.net.DatagramSocketImpl Binds a datagram socket to a local port and address. bind(String, Remote). Static method in class java.rmi.Naming Binds the name to the specified remote object. bind(String, Remote). Method in interface java.rmi.registry.Registry Binds the name to the specified remote object. BindException(). Constructor for class java.net.BindException Construct a new BindException with no detailed message. BindException(String). Constructor for class java.net.BindException Constructs a new BindException with the specified detail message as to why the bind error occurred. BIT. Static variable in class java.sql.Types bitCount(). Method in class java.math.BigInteger Returns the number of bits in the two's complement representation of this number that differ from its sign bit. bitLength(). Method in class java.math.BigInteger Returns the number of bits in the minimal two's-complement representation of this number, *excluding* a sign bit, i.e., (ceil(log2(this < 0 ? -this : this + 1))). BitSet(). Constructor for class java.util.BitSet Creates a new bit set. BitSet(int). Constructor for class java.util.BitSet Creates a bit set whose initial size is the specified number of bits. black. Static variable in class java.awt.Color The color black. BLOCK_DECREMENT. Static variable in class java.awt.event.AdjustmentEvent The block decrement adjustment type. BLOCK_INCREMENT. Static variable in class java.awt.event.AdjustmentEvent The block increment adjustment type. blue. Static variable in class java.awt.Color The color blue. BOLD. Static variable in class java.awt.Font The bold style constant. Boolean(boolean). Constructor for class java.lang.Boolean Allocates a Boolean object representing the value argument. Boolean(String). Constructor for class java.lang.Boolean Allocates a Boolean object representing the value true if the string argument is not null and is equal, ignoring case, to the string "true". booleanValue(). Method in class java.lang.Boolean Returns the value of this Boolean object as a boolean. BorderLayout(). Constructor for class java.awt.BorderLayout Constructs a new BorderLayout with no gaps between components. BorderLayout(int, int). Constructor for class java.awt.BorderLayout Constructs a BorderLayout with the specified gaps. BOTH. Static variable in class java.awt.GridBagConstraints bottom. Variable in class java.awt.Insets The inset from the bottom. BOTTOM_ALIGNMENT. Static variable in class java.awt.Component Ease of use constant for getAlignmentY(). bounds. Variable in class java.awt.Polygon bounds(). Method in class java.awt.Component BreakIterator(). Constructor for class java.text.BreakIterator

ww w. ja

va
298

dil

i.c o

m

299
Constructor. breakpointEvent(RemoteThread). Method in interface sun.tools.debug.DebuggerCallback A breakpoint has been hit in the specified thread. BRIEF. Static variable in class java.rmi.server.LogStream brighter(). Method in class java.awt.Color Returns a brighter version of this color. buf. Variable in class java.io.BufferedInputStream The buffer where data is stored. buf. Variable in class java.io.BufferedOutputStream The buffer where data is stored. buf. Variable in class java.io.ByteArrayInputStream The byte array containing the data. buf. Variable in class java.io.ByteArrayOutputStream The buffer where data is stored. buf. Variable in class java.io.CharArrayReader Character buffer buf. Variable in class java.io.CharArrayWriter The buffer where data is stored. buf. Variable in class java.util.zip.DeflaterOutputStream Output buffer for writing compressed data. buf. Variable in class java.util.zip.InflaterInputStream Input buffer for decompression. buf. Variable in class java.io.PushbackInputStream The push back buffer. buffer. Variable in class java.io.PipedInputStream The circular buffer into which incoming data is placed. buffer. Variable in class java.io.StringBufferInputStream The string from which bytes are read. BufferedInputStream(InputStream). Constructor for class java.io.BufferedInputStream Creates a new buffered input stream to read data from the specified input stream with a default 512-byte buffer size. BufferedInputStream(InputStream, int). Constructor for class java.io.BufferedInputStream Creates a new buffered input stream to read data from the specified input stream with the specified buffer size. BufferedOutputStream(OutputStream). Constructor for class java.io.BufferedOutputStream Creates a new buffered output stream to write data to the specified underlying output stream with a default 512-byte buffer size. BufferedOutputStream(OutputStream, int). Constructor for class java.io.BufferedOutputStream Creates a new buffered output stream to write data to the specified underlying output stream with the specified buffer size. BufferedReader(Reader). Constructor for class java.io.BufferedReader Create a buffering character-input stream that uses a default-sized input buffer. BufferedReader(Reader, int). Constructor for class java.io.BufferedReader Create a buffering character-input stream that uses an input buffer of the specified size. BufferedWriter(Writer). Constructor for class java.io.BufferedWriter Create a buffered character-output stream that uses a default-sized output buffer. BufferedWriter(Writer, int). Constructor for class java.io.BufferedWriter Create a new buffered character-output stream that uses an output buffer of the given size. Button(). Constructor for class java.awt.Button Constructs a Button with no label. Button(String). Constructor for class java.awt.Button Constructs a Button with the specified label. BUTTON1_MASK. Static variable in class java.awt.event.InputEvent The mouse button1 modifier constant. BUTTON2_MASK. Static variable in class java.awt.event.InputEvent The mouse button2 modifier constant. BUTTON3_MASK. Static variable in class java.awt.event.InputEvent The mouse button3 modifier constant. Byte(byte). Constructor for class java.lang.Byte Constructs a Byte object initialized to the specified byte value. Byte(String). Constructor for class java.lang.Byte Constructs a Byte object initialized to the value specified by the String parameter. ByteArrayInputStream(byte[]). Constructor for class java.io.ByteArrayInputStream Creates a new byte array input stream that reads data from the specified byte array. ByteArrayInputStream(byte[], int, int). Constructor for class java.io.ByteArrayInputStream Creates a new byte array input stream that reads data from the specified byte array. ByteArrayOutputStream(). Constructor for class java.io.ByteArrayOutputStream Creates a new byte array output stream. ByteArrayOutputStream(int). Constructor for class java.io.ByteArrayOutputStream Creates a new byte array output stream, with a buffer capacity of the specified size, in bytes. bytesTransferred. Variable in class java.io.InterruptedIOException Reports how many bytes had been transferred as part of the I/O operation before it was interrupted. bytesWidth(byte[], int, int). Method in class java.awt.FontMetrics Returns the total advance width for showing the specified array of bytes in this Font. byteValue(). Method in class java.lang.Byte Returns the value of this Byte as a byte. byteValue(). Method in class java.lang.Double Returns the value of this Double as a byte (by casting to a byte). byteValue(). Method in class java.lang.Float

ww w. ja

va
299

dil

i.c o

m

300
Returns the value of this Float as a byte (by casting to a byte). byteValue(). Method in class java.lang.Integer Returns the value of this Integer as a byte. byteValue(). Method in class java.lang.Long Returns the value of this Long as a byte. byteValue(). Method in class java.lang.Number Returns the value of the specified number as a byte. byteValue(). Method in class java.lang.Short Returns the value of this Short as a byte.

C

ww w. ja

calendar. Variable in class java.text.DateFormat The calendar that DateFormat uses to produce the time field values needed to implement date/time formatting. Calendar(). Constructor for class java.util.Calendar Constructs a Calendar with the default time zone as returned by TimeZone.getDefault(), and the default locale. Calendar(TimeZone, Locale). Constructor for class java.util.Calendar Constructs a Calendar with the given time zone and locale. CANADA. Static variable in class java.util.Locale Useful constant for country. CANADA_FRENCH. Static variable in class java.util.Locale Useful constant for country. cancel(). Method in interface java.sql.Statement Cancel can be used by one thread to cancel a statement that is being executed by another thread. canFilterIndexColorModel. Variable in class java.awt.image.RGBImageFilter This boolean indicates whether or not it is acceptable to apply the color filtering of the filterRGB method to the color table entries of an IndexColorModel object in lieu of pixel by pixel filtering. CANONICAL_DECOMPOSITION. Static variable in class java.text.Collator Decomposition mode value. canRead(). Method in class java.io.File Tests if the application can read from the specified file. Canvas(). Constructor for class java.awt.Canvas Constructs a new Canvas. canWrite(). Method in class java.io.File Tests if the application can write to this file. capacity(). Method in class java.lang.StringBuffer Returns the current capacity of the String buffer. capacity(). Method in class java.util.Vector Returns the current capacity of this vector. capacityIncrement. Variable in class java.util.Vector The amount by which the capacity of the vector is automatically incremented when its size becomes greater than its capacity. CAPS_LOCK. Static variable in class java.awt.Event The CapsLock action-key. CardLayout(). Constructor for class java.awt.CardLayout Creates a new card layout with gaps of size zero. CardLayout(int, int). Constructor for class java.awt.CardLayout Creates a card layout with the specified gaps. catchExceptions(). Method in class sun.tools.debug.RemoteClass Enter the debugger when an instance of this class is thrown. ceil(double). Static method in class java.lang.Math Returns the smallest (closest to negative infinity) double value that is not less than the argument and is equal to a mathematical integer. CENTER. Static variable in class java.awt.BorderLayout The center layout constraint. CENTER. Static variable in class java.awt.FlowLayout The right alignment variable. CENTER. Static variable in class java.awt.GridBagConstraints CENTER. Static variable in class java.awt.Label The center alignment. CENTER_ALIGNMENT. Static variable in class java.awt.Component Ease of use constant for getAlignmentY() and getAlignmentX(). certificates(). Method in class java.security.Identity Returns a copy of all the certificates for this identity. CHAR. Static variable in class java.sql.Types CHAR_UNDEFINED. Static variable in class java.awt.event.KeyEvent KEY_PRESSED and KEY_RELEASED events which do not map to a valid Unicode character do not have a defined keyChar. Character(char). Constructor for class java.lang.Character Constructs a Character object and initializes it so that it represents the primitive value argument. CharArrayReader(char[]). Constructor for class java.io.CharArrayReader Create an CharArrayReader from the specified array of chars. CharArrayReader(char[], int, int). Constructor for class java.io.CharArrayReader Create an CharArrayReader from the specified array of chars. CharArrayWriter(). Constructor for class java.io.CharArrayWriter

va
300

dil

i.c o

m

301
Creates a new CharArrayWriter. CharArrayWriter(int). Constructor for class java.io.CharArrayWriter Creates a new CharArrayWriter with the specified initial size. charAt(int). Method in class java.lang.String Returns the character at the specified index. charAt(int). Method in class java.lang.StringBuffer Returns the character at a specific index in this string buffer. CharConversionException(). Constructor for class java.io.CharConversionException provides no detailed message CharConversionException(String). Constructor for class java.io.CharConversionException provides a detailed message charsWidth(char[], int, int). Method in class java.awt.FontMetrics Returns the total advance width for showing the specified array of characters in this Font. charValue(). Method in class java.lang.Character Returns the value of this Character object. charWidth(char). Method in class java.awt.FontMetrics Returns the advance width of the specified character in this Font. charWidth(int). Method in class java.awt.FontMetrics Returns the advance width of the specified character in this Font. checkAccept(String, int). Method in class java.rmi.RMISecurityManager For now stubs can't accept connections on any port. checkAccept(String, int). Method in class java.lang.SecurityManager Throws a SecurityException if the calling thread is not permitted to accept a socket connection from the specified host and port number. checkAccess(). Method in class java.lang.Thread Determines if the currently running thread has permission to modify this thread. checkAccess(). Method in class java.lang.ThreadGroup Determines if the currently running thread has permission to modify this thread group. checkAccess(Thread). Method in class java.rmi.RMISecurityManager Stubs are not allowed to manipulate threads. checkAccess(Thread). Method in class java.lang.SecurityManager Throws a SecurityException if the calling thread is not allowed to modify the thread argument. checkAccess(ThreadGroup). Method in class java.rmi.RMISecurityManager Stubs are not allowed to manipulate thread groups. checkAccess(ThreadGroup). Method in class java.lang.SecurityManager Throws a SecurityException if the calling thread is not allowed to modify the thread group argument. checkAll(). Method in class java.awt.MediaTracker Checks to see if all images have finished loading but does not start loading the images if they are not already loading. checkAll(boolean). Method in class java.awt.MediaTracker Checks to see if all images have finished loading. checkAwtEventQueueAccess(). Method in class java.rmi.RMISecurityManager Checks to see if an client can get access to the AWT event queue (disallowed from stubs). checkAwtEventQueueAccess(). Method in class java.lang.SecurityManager Tests if a client can get access to the AWT event queue. Checkbox(). Constructor for class java.awt.Checkbox Constructs a Checkbox with an empty label. Checkbox(String). Constructor for class java.awt.Checkbox Constructs a Checkbox with the specified label. Checkbox(String, boolean). Constructor for class java.awt.Checkbox Constructs a Checkbox with the specified label. Checkbox(String, boolean, CheckboxGroup). Constructor for class java.awt.Checkbox Constructs a Checkbox with the specified label, set to the specified state, and in the specified check box group. Checkbox(String, CheckboxGroup, boolean). Constructor for class java.awt.Checkbox Constructs a Checkbox with the specified label, set to the specified state, and in the specified check box group. CheckboxGroup(). Constructor for class java.awt.CheckboxGroup Creates a new CheckboxGroup. CheckboxMenuItem(). Constructor for class java.awt.CheckboxMenuItem Creates a checkbox menu item with an empty label, initially set to off (false state). CheckboxMenuItem(String). Constructor for class java.awt.CheckboxMenuItem Creates the checkbox item with the specified label, initially set to off (false state). CheckboxMenuItem(String, boolean). Constructor for class java.awt.CheckboxMenuItem Creates a checkbox menu item with the specified label and state. checkConnect(String, int). Method in class java.rmi.RMISecurityManager Stubs can make connections if called through the RMI transport. checkConnect(String, int). Method in class java.lang.SecurityManager Throws a SecurityException if the calling thread is not allowed to open a socket connection to the specified host and port number. checkConnect(String, int, Object). Method in class java.rmi.RMISecurityManager Downloaded classes (including stubs) can make connections if called through the RMI transport. checkConnect(String, int, Object). Method in class java.lang.SecurityManager Throws a SecurityException if the specified security context is not allowed to open a socket connection to the specified host and port number. checkCreateClassLoader(). Method in class java.rmi.RMISecurityManager Stubs are not allowed to create class loaders, or even execute any of ClassLoader's methods. checkCreateClassLoader(). Method in class java.lang.SecurityManager Throws a SecurityException if the calling thread is not allowed to create a new class loader.

ww w. ja

va
301

dil

i.c o

m

302
checkDelete(String). Method in class java.rmi.RMISecurityManager Check if a file with the specified system dependent file name can be deleted. checkDelete(String). Method in class java.lang.SecurityManager Throws a SecurityException if the calling thread is not allowed to delete the specified file. CheckedInputStream(InputStream, Checksum). Constructor for class java.util.zip.CheckedInputStream Creates an input stream using the specified Checksum. CheckedOutputStream(OutputStream, Checksum). Constructor for class java.util.zip.CheckedOutputStream Creates an output stream with the specified Checksum. checkError(). Method in class java.io.PrintStream Flushes this print stream's underlying output stream, and tests if there has been an error on the underlying output stream. checkError(). Method in class java.io.PrintWriter Flush the stream and check its error state. checkExec(String). Method in class java.rmi.RMISecurityManager Stubs are not allowed to fork processes. checkExec(String). Method in class java.lang.SecurityManager Throws a SecurityException if the calling thread is not allowed to create a subprocss. checkExit(int). Method in class java.rmi.RMISecurityManager Stubs are not allowed to exit the VM. checkExit(int). Method in class java.lang.SecurityManager Throws a SecurityException if the calling thread is not allowed to cause the Java Virtual Machine to halt with the specified status code. checkID(int). Method in class java.awt.MediaTracker Checks to see if all images tagged with the indicated ID have finished loading, but does not start loading the images if they are not already loading. checkID(int, boolean). Method in class java.awt.MediaTracker Checks to see if all images tagged with the indicated ID have finished loading. checkImage(Image, ImageObserver). Method in class java.awt.Component Returns the status of the construction of a screen representation of the specified image. checkImage(Image, int, int, ImageObserver). Method in class java.awt.Component Returns the status of the construction of a scaled screen representation of the specified image. checkImage(Image, int, int, ImageObserver). Method in interface java.awt.peer.ComponentPeer checkImage(Image, int, int, ImageObserver). Method in class java.awt.Toolkit Returns the status of the construction of the indicated method at the indicated width and height for the default screen. checkLink(String). Method in class java.rmi.RMISecurityManager Stubs are not allowed to link dynamic libraries. checkLink(String). Method in class java.lang.SecurityManager Throws a SecurityException if the calling thread is not allowed to dynamic link the library code specified by the string argument file. checkListen(int). Method in class java.rmi.RMISecurityManager For now stubs can't listen on any port. checkListen(int). Method in class java.lang.SecurityManager Throws a SecurityException if the calling thread is not allowed to wait for a connection request on the specified local port number. checkMemberAccess(Class, int). Method in class java.rmi.RMISecurityManager Checks to see if client code can access class members. checkMemberAccess(Class, int). Method in class java.lang.SecurityManager Tests if a client is allowed to access members. checkMulticast(InetAddress). Method in class java.rmi.RMISecurityManager Checks to see if current execution context is allowed to use (join/leave/send/receive) IP multicast (disallowed from stubs). checkMulticast(InetAddress). Method in class java.lang.SecurityManager Tests if current execution context is allowed to use (join/leave/send/receive) IP multicast. checkMulticast(InetAddress, byte). Method in class java.rmi.RMISecurityManager Checks to see if current execution context is allowed to use (join/leave/send/receive) IP multicast (disallowed from stubs). checkMulticast(InetAddress, byte). Method in class java.lang.SecurityManager Tests to see if current execution context is allowed to use (join/leave/send/receive) IP multicast. checkPackageAccess(String). Method in class java.rmi.RMISecurityManager Check if a stub can access a package. checkPackageAccess(String). Method in class java.lang.SecurityManager Throws a SecurityException if the calling thread is not allowed to access the package specified by the argument. checkPackageDefinition(String). Method in class java.rmi.RMISecurityManager Check if a stub can define classes in a package. checkPackageDefinition(String). Method in class java.lang.SecurityManager Throws a SecurityException if the calling thread is not allowed to define classes in the package specified by the argument. checkPermission(Permission). Method in interface java.security.acl.AclEntry Checks if the specified permission is part of the permission set in this entry. checkPermission(Principal, Permission). Method in interface java.security.acl.Acl Checks whether or not the specified principal has the specified permission. checkPrintJobAccess(). Method in class java.rmi.RMISecurityManager Disallow printing from stubs. checkPrintJobAccess(). Method in class java.lang.SecurityManager Tests if a client can initiate a print job request. checkPropertiesAccess(). Method in class java.rmi.RMISecurityManager Stubs are not allowed to access the entire system properties list, only properties explicitly labeled as accessible to stubs. checkPropertiesAccess(). Method in class java.lang.SecurityManager Throws a SecurityException if the calling thread is not allowed to access or modify the system properties. checkPropertyAccess(String). Method in class java.rmi.RMISecurityManager

ww w. ja

va
302

dil

i.c o

m

303
Stubs can access the system property named by key only if its twin key.stub property is set to true. checkPropertyAccess(String). Method in class java.lang.SecurityManager Throws a SecurityException if the calling thread is not allowed to access the system property with the specified key name. checkRead(FileDescriptor). Method in class java.rmi.RMISecurityManager Stubs are not allowed to open file descriptors for reading unless it is done through a socket, in which case other access restrictions still apply. checkRead(FileDescriptor). Method in class java.lang.SecurityManager Throws a SecurityException if the calling thread is not allowed to read from the specified file descriptor. checkRead(String). Method in class java.rmi.RMISecurityManager Check if a stub can read a particular file. checkRead(String). Method in class java.lang.SecurityManager Throws a SecurityException if the calling thread is not allowed to read the file specified by the string argument. checkRead(String, Object). Method in class java.rmi.RMISecurityManager No file reads are valid from a stub. checkRead(String, Object). Method in class java.lang.SecurityManager Throws a SecurityException if the specified security context is not allowed to read the file specified by the string argument. checkSecurityAccess(String). Method in class java.rmi.RMISecurityManager Stubs cannot perform security provider operations. checkSecurityAccess(String). Method in class java.lang.SecurityManager Tests access to certain operations for a security API action. checkSetFactory(). Method in class java.rmi.RMISecurityManager Check if a stub can set a networking-related object factory. checkSetFactory(). Method in class java.lang.SecurityManager Throws a SecurityException if the calling thread is not allowed to set the socket factory used by ServerSocket or Socket, or the stream handler factory used by URL. checkSystemClipboardAccess(). Method in class java.rmi.RMISecurityManager Checks to see if an client can get access to the System Clipboard (disallowed from stubs). checkSystemClipboardAccess(). Method in class java.lang.SecurityManager Tests if a client can get access to the system clipboard. checkTopLevelWindow(Object). Method in class java.rmi.RMISecurityManager Allow caller to create top-level windows. checkTopLevelWindow(Object). Method in class java.lang.SecurityManager Returns false if the calling thread is not trusted to bring up the top-level window indicated by the window argument. checkWrite(FileDescriptor). Method in class java.rmi.RMISecurityManager Stubs are not allowed to open file descriptors for writing unless it is done through a socket, in which case other access restrictions still apply. checkWrite(FileDescriptor). Method in class java.lang.SecurityManager Throws a SecurityException if the calling thread is not allowed to write to the specified file descriptor. checkWrite(String). Method in class java.rmi.RMISecurityManager Check if a Stub can write a particular file. checkWrite(String). Method in class java.lang.SecurityManager Throws a SecurityException if the calling thread is not allowed to write to the file specified by the string argument. childResized(int, int). Method in interface java.awt.peer.ScrollPanePeer CHINA. Static variable in class java.util.Locale Useful constant for country. CHINESE. Static variable in class java.util.Locale Useful constant for language. Choice(). Constructor for class java.awt.Choice Constructs a new Choice. ChoiceFormat(double[], String[]). Constructor for class java.text.ChoiceFormat Constructs with the limits and the corresponding formats. ChoiceFormat(String). Constructor for class java.text.ChoiceFormat Constructs with limits and corresponding formats based on the pattern. choices. Variable in class java.sql.DriverPropertyInfo If the value may be selected from a particular set of values, then this is an array of the possible values. ClassCastException(). Constructor for class java.lang.ClassCastException Constructs a ClassCastException with no detail message. ClassCastException(String). Constructor for class java.lang.ClassCastException Constructs a ClassCastException with the specified detail message. ClassCircularityError(). Constructor for class java.lang.ClassCircularityError Constructs a ClassCircularityError with no detail message. ClassCircularityError(String). Constructor for class java.lang.ClassCircularityError Constructs a ClassCircularityError with the specified detail message. classDepth(String). Method in class java.lang.SecurityManager Returns the stack depth of the specified class. ClassFormatError(). Constructor for class java.lang.ClassFormatError Constructs a ClassFormatError with no detail message. ClassFormatError(String). Constructor for class java.lang.ClassFormatError Constructs a ClassFormatError with the specified detail message. ClassLoader(). Constructor for class java.lang.ClassLoader Constructs a new class loader and initializes it. classLoaderDepth(). Method in class java.lang.SecurityManager Returns the stack depth of the most recently executing method from a class defined using a class loader. classname. Variable in class java.io.InvalidClassException

ww w. ja

va
303

dil

i.c o

m

304
ClassNotFoundException(). Constructor for class java.lang.ClassNotFoundException Constructs a ClassNotFoundException with no detail message. ClassNotFoundException(String). Constructor for class java.lang.ClassNotFoundException Constructs a ClassNotFoundException with the specified detail message. clean(ObjID[], long, VMID, boolean). Method in interface java.rmi.dgc.DGC The clean call removes the 'vmid' from the reference list of each remote object indicated in 'id's. clear(). Method in class java.util.Calendar Clears the values of all the time fields. clear(). Method in class java.util.Hashtable Clears this hashtable so that it contains no keys. clear(). Method in class java.awt.List clear(). Method in interface java.awt.peer.ListPeer DEPRECATED: Replaced by removeAll(). clear(int). Method in class java.util.BitSet Sets the bit specified by the index to false. clear(int). Method in class java.util.Calendar Clears the value in the given time field. clearBit(int). Method in class java.math.BigInteger Returns a BigInteger whose value is equivalent to this number with the designated bit cleared. clearBreakpoint(int). Method in class sun.tools.debug.RemoteClass Clear a breakpoint at a specific address in a class. clearBreakpointLine(int). Method in class sun.tools.debug.RemoteClass Clear a breakpoint at a specified line. clearBreakpointMethod(RemoteField). Method in class sun.tools.debug.RemoteClass Clear a breakpoint at the start of a specified method. clearChanged(). Method in class java.util.Observable Indicates that this object has no longer changed, or that it has already notified all of its observers of its most recent change. clearParameters(). Method in interface java.sql.PreparedStatement In general, parameter values remain in force for repeated use of a Statement. clearRect(int, int, int, int). Method in class java.awt.Graphics Clears the specified rectangle by filling it with the background color of the current drawing surface. clearWarnings(). Method in interface java.sql.Connection After this call, getWarnings returns null until a new warning is reported for this Connection. clearWarnings(). Method in interface java.sql.ResultSet After this call getWarnings returns null until a new warning is reported for this ResultSet. clearWarnings(). Method in interface java.sql.Statement After this call, getWarnings returns null until a new warning is reported for this Statement. clickCount. Variable in class java.awt.Event The number of consecutive clicks. Clipboard(String). Constructor for class java.awt.datatransfer.Clipboard Creates a clipboard object. clipRect(int, int, int, int). Method in class java.awt.Graphics Intersects the current clip with the specified rectangle. clone(). Method in interface java.security.acl.AclEntry Clones this ACL entry. clone(). Method in class java.util.BitSet Clones this BitSet. clone(). Method in class java.text.BreakIterator Create a copy of this boundary clone(). Method in class java.util.Calendar Overrides Cloneable clone(). Method in interface java.text.CharacterIterator Create a copy of this iterator clone(). Method in class java.text.ChoiceFormat Overrides Cloneable clone(). Method in class java.text.Collator Overrides Cloneable clone(). Method in class java.text.DateFormat Overrides Cloneable clone(). Method in class java.text.DateFormatSymbols Overrides Cloneable clone(). Method in class java.text.DecimalFormat Standard override; no change in semantics. clone(). Method in class java.text.DecimalFormatSymbols Standard override. clone(). Method in class java.text.Format Creates a new object of the same class as this object. clone(). Method in class java.util.GregorianCalendar Overrides Cloneable clone(). Method in class java.awt.GridBagConstraints Creates a new object of the same class as this object. clone(). Method in class java.util.Hashtable Creates a shallow copy of this hashtable. clone(). Method in class java.awt.image.ImageFilter Clones this object.

ww w. ja

va
304

dil

i.c o

m

305
clone(). Method in class java.awt.Insets Creates a new object of the same class as this object. clone(). Method in class java.util.Locale Overrides Cloneable clone(). Method in class java.security.MessageDigest Returns a clone if the implementation is cloneable. clone(). Method in class java.text.MessageFormat Overrides Cloneable clone(). Method in class java.text.NumberFormat Overrides Cloneable clone(). Method in class java.lang.Object Creates a new object of the same class as this object. clone(). Method in class java.text.RuleBasedCollator Standard override; no change in semantics. clone(). Method in class java.security.Signature Returns a clone if the implementation is cloneable. clone(). Method in class java.text.SimpleDateFormat Overrides Cloneable clone(). Method in class java.util.SimpleTimeZone Overrides Cloneable clone(). Method in class java.text.StringCharacterIterator Create a copy of this boundary clone(). Method in class java.util.TimeZone Overrides Cloneable clone(). Method in class java.rmi.server.UnicastRemoteObject Returns a clone of the remote object that is distinct from the original. clone(). Method in class java.util.Vector Returns a clone of this vector. CloneNotSupportedException(). Constructor for class java.lang.CloneNotSupportedException Constructs a CloneNotSupportedException with no detail message. CloneNotSupportedException(String). Constructor for class java.lang.CloneNotSupportedException Constructs a CloneNotSupportedException with the specified detail message. close(). Method in class java.io.BufferedReader Close the stream. close(). Method in class java.io.BufferedWriter Close the stream. close(). Method in class java.io.CharArrayReader Close the stream. close(). Method in class java.io.CharArrayWriter Close the stream. close(). Method in interface java.sql.Connection In some cases, it is desirable to immediately release a Connection's database and JDBC resources instead of waiting for them to be automatically released; the close method provides this immediate release. close(). Method in class java.net.DatagramSocket Closes this datagram socket. close(). Method in class java.net.DatagramSocketImpl Close the socket. close(). Method in class java.util.zip.DeflaterOutputStream Writes remaining compressed data to the output stream and closes the underlying stream. close(). Method in class java.io.FileInputStream Closes this file input stream and releases any system resources associated with the stream. close(). Method in class java.io.FileOutputStream Closes this file output stream and releases any system resources associated with this stream. close(). Method in class java.io.FilterInputStream Closes this input stream and releases any system resources associated with the stream. close(). Method in class java.io.FilterOutputStream Closes this output stream and releases any system resources associated with the stream. close(). Method in class java.io.FilterReader Close the stream. close(). Method in class java.io.FilterWriter Close the stream. close(). Method in class java.util.zip.GZIPInputStream Closes the input stream. close(). Method in class java.util.zip.GZIPOutputStream Writes remaining compressed data to the output stream and closes the underlying stream. close(). Method in class java.io.InputStream Closes this input stream and releases any system resources associated with the stream. close(). Method in class java.io.InputStreamReader Close the stream. close(). Method in interface java.io.ObjectInput Closes the input stream. close(). Method in class java.io.ObjectInputStream Closes the input stream. close(). Method in interface java.io.ObjectOutput Closes the stream. close(). Method in class java.io.ObjectOutputStream

ww w. ja

va
305

dil

i.c o

m

306
Closes the stream. close(). Method in class java.io.OutputStream Closes this output stream and releases any system resources associated with this stream. close(). Method in class java.io.OutputStreamWriter Close the stream. close(). Method in class java.io.PipedInputStream Closes this piped input stream and releases any system resources associated with the stream. close(). Method in class java.io.PipedOutputStream Closes this piped output stream and releases any system resources associated with this stream. close(). Method in class java.io.PipedReader Close the stream. close(). Method in class java.io.PipedWriter Close the stream. close(). Method in class java.io.PrintStream Closes this print stream and releases any resources associated with the underlying output stream. close(). Method in class java.io.PrintWriter Close the stream. close(). Method in class java.io.PushbackReader Close the stream. close(). Method in class java.io.RandomAccessFile Closes this random access file stream and releases any system resources associated with the stream. close(). Method in class java.io.Reader Close the stream. close(). Method in class sun.tools.debug.RemoteDebugger Close the connection to the remote debugging agent. close(). Method in interface java.sql.ResultSet In some cases, it is desirable to immediately release a ResultSet's database and JDBC resources instead of waiting for this to happen when it is automatically closed; the close method provides this immediate release. close(). Method in class java.io.SequenceInputStream Closes this input stream and releases any system resources associated with the stream. close(). Method in class java.net.ServerSocket Closes this socket. close(). Method in class java.net.Socket Closes this socket. close(). Method in class java.net.SocketImpl Closes this socket. close(). Method in interface java.sql.Statement In many cases, it is desirable to immediately release a Statements's database and JDBC resources instead of waiting for this to happen when it is automatically closed; the close method provides this immediate release. close(). Method in class java.io.StringReader Close the stream. close(). Method in class java.io.StringWriter Close the stream. close(). Method in class java.io.Writer Close the stream, flushing it first. close(). Method in class java.util.zip.ZipFile Closes the ZIP file. close(). Method in class java.util.zip.ZipInputStream Closes the ZIP input stream. close(). Method in class java.util.zip.ZipOutputStream Closes the ZIP output stream as well as the stream being filtered. closeEntry(). Method in class java.util.zip.ZipInputStream Closes the current ZIP entry and positions the stream for reading the next entry. closeEntry(). Method in class java.util.zip.ZipOutputStream Closes the current ZIP entry and positions the stream for writing the next entry. Collator(). Constructor for class java.text.Collator Default constructor. Color(float, float, float). Constructor for class java.awt.Color Creates a color with the specified red, green, and blue values in the range (0.0 - 1.0). Color(int). Constructor for class java.awt.Color Creates a color with the specified combined RGB value consisting of the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7. Color(int, int, int). Constructor for class java.awt.Color Creates a color with the specified red, green, and blue values in the range (0 - 255). ColorModel(int). Constructor for class java.awt.image.ColorModel Constructs a ColorModel which describes a pixel of the specified number of bits. columnNoNulls. Static variable in interface java.sql.DatabaseMetaData COLUMN NULLABLE - might not allow NULL values. columnNoNulls. Static variable in interface java.sql.ResultSetMetaData Does not allow NULL values. columnNullable. Static variable in interface java.sql.DatabaseMetaData COLUMN NULLABLE - definitely allows NULL values. columnNullable. Static variable in interface java.sql.ResultSetMetaData Allows NULL values. columnNullableUnknown. Static variable in interface java.sql.DatabaseMetaData COLUMN NULLABLE - nullability unknown.

ww w. ja

va
306

dil

i.c o

m

307
columnNullableUnknown. Static variable in interface java.sql.ResultSetMetaData Nullability unknown. columnWeights. Variable in class java.awt.GridBagLayout columnWidths. Variable in class java.awt.GridBagLayout COMBINING_SPACING_MARK. Static variable in class java.lang.Character command(Object). Static method in class java.lang.Compiler Examines the argument type and its fields and perform some documented operation. commentChar(int). Method in class java.io.StreamTokenizer Specified that the character argument starts a single-line comment. commit(). Method in interface java.sql.Connection Commit makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by the Connection. compare(String, String). Method in class java.text.Collator Compares the source string to the target string according to the collation rules for this Collator. compare(String, String). Method in class java.text.RuleBasedCollator Compares the character data stored in two different strings based on the collation rules. compareTo(BigDecimal). Method in class java.math.BigDecimal Returns -1, 0 or 1 as this number is less than, equal to, or greater than val. compareTo(BigInteger). Method in class java.math.BigInteger Returns -1, 0 or 1 as this number is less than, equal to, or greater than val. compareTo(CollationKey). Method in class java.text.CollationKey Compare this CollationKey to the target CollationKey. compareTo(String). Method in class java.lang.String Compares two strings lexicographically. compileClass(Class). Static method in class java.lang.Compiler Compiles the specified class. compileClasses(String). Static method in class java.lang.Compiler Compiles all classes whose name matches the specified string. COMPLETE. Static variable in class java.awt.MediaTracker Flag indicating the download of media completed successfully. complete(). Method in class java.util.Calendar Fills in any unset fields in the time field list. COMPLETESCANLINES. Static variable in interface java.awt.image.ImageConsumer The pixels will be delivered in (multiples of) complete scanlines at a time. Component(). Constructor for class java.awt.Component Constructs a new Component. COMPONENT_ADDED. Static variable in class java.awt.event.ContainerEvent The component moved event type. COMPONENT_EVENT_MASK. Static variable in class java.awt.AWTEvent The event mask for selecting component events. COMPONENT_FIRST. Static variable in class java.awt.event.ComponentEvent Marks the first integer id for the range of component event ids. COMPONENT_HIDDEN. Static variable in class java.awt.event.ComponentEvent The component hidden event type. COMPONENT_LAST. Static variable in class java.awt.event.ComponentEvent Marks the last integer id for the range of component event ids. COMPONENT_MOVED. Static variable in class java.awt.event.ComponentEvent The component moved event type. COMPONENT_REMOVED. Static variable in class java.awt.event.ContainerEvent The component resized event type. COMPONENT_RESIZED. Static variable in class java.awt.event.ComponentEvent The component resized event type. COMPONENT_SHOWN. Static variable in class java.awt.event.ComponentEvent The component shown event type. ComponentAdapter(). Constructor for class java.awt.event.ComponentAdapter componentAdded(ContainerEvent). Method in class java.awt.AWTEventMulticaster Handles the componentAdded container event by invoking the componentAdded methods on listener-a and listener-b. componentAdded(ContainerEvent). Method in class java.awt.event.ContainerAdapter componentAdded(ContainerEvent). Method in interface java.awt.event.ContainerListener Invoked when a component has been added to the container. ComponentEvent(Component, int). Constructor for class java.awt.event.ComponentEvent Constructs a ComponentEvent object with the specified source component and type. componentHidden(ComponentEvent). Method in class java.awt.AWTEventMulticaster Handles the componentHidden event by invoking the componentHidden methods on listener-a and listener-b. componentHidden(ComponentEvent). Method in class java.awt.event.ComponentAdapter componentHidden(ComponentEvent). Method in interface java.awt.event.ComponentListener Invoked when component has been hidden. componentMoved(ComponentEvent). Method in class java.awt.AWTEventMulticaster Handles the componentMoved event by invoking the componentMoved methods on listener-a and listener-b. componentMoved(ComponentEvent). Method in class java.awt.event.ComponentAdapter componentMoved(ComponentEvent). Method in interface java.awt.event.ComponentListener Invoked when component has been moved. componentRemoved(ContainerEvent). Method in class java.awt.AWTEventMulticaster Handles the componentRemoved container event by invoking the componentRemoved methods on listener-a and listener-b. componentRemoved(ContainerEvent). Method in class java.awt.event.ContainerAdapter componentRemoved(ContainerEvent). Method in interface java.awt.event.ContainerListener

ww w. ja

va
307

dil

i.c o

m

308
Invoked when a component has been removed from the container. componentResized(ComponentEvent). Method in class java.awt.AWTEventMulticaster Handles the componentResized event by invoking the componentResized methods on listener-a and listener-b. componentResized(ComponentEvent). Method in class java.awt.event.ComponentAdapter componentResized(ComponentEvent). Method in interface java.awt.event.ComponentListener Invoked when component has been resized. componentShown(ComponentEvent). Method in class java.awt.AWTEventMulticaster Handles the componentShown event by invoking the componentShown methods on listener-a and listener-b. componentShown(ComponentEvent). Method in class java.awt.event.ComponentAdapter componentShown(ComponentEvent). Method in interface java.awt.event.ComponentListener Invoked when component has been shown. comptable. Variable in class java.awt.GridBagLayout computeFields(). Method in class java.util.Calendar Converts UTC as milliseconds to time field values. computeFields(). Method in class java.util.GregorianCalendar Overrides Calendar Converts UTC as milliseconds to time field values. computeTime(). Method in class java.util.Calendar Converts Calendar's time field values to UTC as milliseconds. computeTime(). Method in class java.util.GregorianCalendar Overrides Calendar Converts time field values to UTC as milliseconds. concat(String). Method in class java.lang.String Concatenates the specified string to the end of this string. connect(). Method in class java.net.URLConnection Opens a communications link to the resource referenced by this URL, if such a connection has not already been established. connect(InetAddress, int). Method in class java.net.SocketImpl Connects this socket to the specified port number on the specified host. connect(PipedInputStream). Method in class java.io.PipedOutputStream Connects this piped output stream to a receiver. connect(PipedOutputStream). Method in class java.io.PipedInputStream Connects this piped input stream to a sender. connect(PipedReader). Method in class java.io.PipedWriter Connect the specified piped reader to this writer. connect(PipedWriter). Method in class java.io.PipedReader Connect the specified piped writer to this reader. connect(String, int). Method in class java.net.SocketImpl Connects this socket to the specified port on the named host. connect(String, Properties). Method in interface java.sql.Driver Try to make a database connection to the given URL. connected. Variable in class java.net.URLConnection If false, this connection object has not created a communications link to the specified URL. ConnectException(). Constructor for class java.net.ConnectException Construct a new ConnectException with no detailed message. ConnectException(String). Constructor for class java.net.ConnectException Constructs a new ConnectException with the specified detail message as to why the connect error occurred. ConnectException(String). Constructor for class java.rmi.ConnectException Create A remote exception with the specified string ConnectException(String, Exception). Constructor for class java.rmi.ConnectException Create A remote exception with the specified string, and the exception specified. ConnectIOException(String). Constructor for class java.rmi.ConnectIOException Create A remote exception with the specified string ConnectIOException(String, Exception). Constructor for class java.rmi.ConnectIOException Create A remote exception with the specified string, and the exception specified. CONNECTOR_PUNCTUATION. Static variable in class java.lang.Character consume(). Method in class java.awt.AWTEvent consume(). Method in class java.awt.event.InputEvent Consumes this event so that it will not be processed in the default manner by the source which originated it. consumed. Variable in class java.awt.AWTEvent consumer. Variable in class java.awt.image.ImageFilter The consumer of the particular image data stream for which this instance of the ImageFilter is filtering data. cont(). Method in class sun.tools.debug.RemoteThread Resume this thread from a breakpoint, unless it previously suspended. Container(). Constructor for class java.awt.Container Constructs a new Container. CONTAINER_EVENT_MASK. Static variable in class java.awt.AWTEvent The event mask for selecting container events. CONTAINER_FIRST. Static variable in class java.awt.event.ContainerEvent Marks the first integer id for the range of container event ids. CONTAINER_LAST. Static variable in class java.awt.event.ContainerEvent Marks the last integer id for the range of container event ids. ContainerAdapter(). Constructor for class java.awt.event.ContainerAdapter ContainerEvent(Component, int, Component). Constructor for class java.awt.event.ContainerEvent Constructs a ContainerEvent object with the specified source container, type, and child which is being added or removed. contains(int, int). Method in class java.awt.Component Checks whether this component "contains" the specified (x, y) location, where x and y are defined to be relative to the coordinate system of this component. contains(int, int). Method in class java.awt.Polygon

ww w. ja

va
308

dil

i.c o

m

309
Determines whether the point (x,y) is inside the Polygon. contains(int, int). Method in class java.awt.Rectangle Checks whether this rectangle contains the specified point. contains(Object). Method in class java.util.Hashtable Tests if some key maps into the specified value in this hashtable. contains(Object). Method in class java.util.Vector Tests if the specified object is a component in this vector. contains(Point). Method in class java.awt.Component Checks whether this component "contains" the specified point, where x and y in the point are defined to be relative to the coordinate system of this component. contains(Point). Method in class java.awt.Polygon Determines whether the specified point is inside the Polygon. contains(Point). Method in class java.awt.Rectangle Checks whether this rectangle contains the specified point. containsKey(Object). Method in class java.util.Hashtable Tests if the specified object is a key in this hashtable. ContentHandler(). Constructor for class java.net.ContentHandler contents. Variable in class java.awt.datatransfer.Clipboard CONTROL. Static variable in class java.lang.Character control. Static variable in class java.awt.SystemColor The background color for control objects. CONTROL. Static variable in class java.awt.SystemColor The array index for the control background color. CONTROL_DK_SHADOW. Static variable in class java.awt.SystemColor The array index for the control dark shadow color. CONTROL_HIGHLIGHT. Static variable in class java.awt.SystemColor The array index for the control highlight color. CONTROL_LT_HIGHLIGHT. Static variable in class java.awt.SystemColor The array index for the control light highlight color. CONTROL_SHADOW. Static variable in class java.awt.SystemColor The array index for the control shadow color. CONTROL_TEXT. Static variable in class java.awt.SystemColor The array index for the control text color. controlDkShadow. Static variable in class java.awt.SystemColor The dark shadow color for control objects. controlDown(). Method in class java.awt.Event Checks if the control key is down. controlHighlight. Static variable in class java.awt.SystemColor The light highlight color for control objects. controlLtHighlight. Static variable in class java.awt.SystemColor The regular highlight color for control objects. controlShadow. Static variable in class java.awt.SystemColor The regular shadow color for control objects. controlText. Static variable in class java.awt.SystemColor The text color for control objects. copyArea(int, int, int, int, int, int). Method in class java.awt.Graphics Copies an area of the Component by a distance specified by dx and dy to the right and down. copyInto(Object[]). Method in class java.util.Vector Copies the components of this vector into the specified array. copyValueOf(char[]). Static method in class java.lang.String Returns a String that is equivalent to the specified character array. copyValueOf(char[], int, int). Static method in class java.lang.String Returns a String that is equivalent to the specified character array. cos(double). Static method in class java.lang.Math Returns the trigonometric cosine of an angle. count. Variable in class java.io.BufferedInputStream The index one greater than the index of the last valid byte in the buffer. count. Variable in class java.io.BufferedOutputStream The number of valid bytes in the buffer. count. Variable in class java.io.ByteArrayInputStream The index one greater than the last valid character in the input stream buffer. count. Variable in class java.io.ByteArrayOutputStream The number of valid bytes in the buffer. count. Variable in class java.io.CharArrayReader Number of valid characters in buffer count. Variable in class java.io.CharArrayWriter The number of chars in the buffer. count. Variable in class java.io.StringBufferInputStream The number of valid characters in the input stream buffer. countComponents(). Method in class java.awt.Container countItems(). Method in class java.awt.Choice countItems(). Method in class java.awt.List countItems(). Method in class java.awt.Menu countMenus(). Method in class java.awt.MenuBar countObservers(). Method in class java.util.Observable Returns the number of observers of this object.

ww w. ja

va
309

dil

i.c o

m

310
countStackFrames(). Method in class java.lang.Thread Counts the number of stack frames in this thread. countTokens(). Method in class java.util.StringTokenizer Calculates the number of times that this tokenizer's nextToken method can be called before it generates an exception. crc. Variable in class java.util.zip.GZIPInputStream CRC-32 for uncompressed data. crc. Variable in class java.util.zip.GZIPOutputStream CRC-32 of uncompressed data. CRC32(). Constructor for class java.util.zip.CRC32 create(). Method in class java.net.DatagramSocketImpl Creates a datagram socket create(). Method in class java.awt.Graphics Creates a new Graphics object that is a copy of this Graphics object. create(boolean). Method in class java.net.SocketImpl Creates either a stream or a datagram socket. create(int, int, int, int). Method in class java.awt.Graphics Creates a new Graphics object based on this Graphics object, but with a new translation and clip area. createButton(Button). Method in class java.awt.Toolkit Uses the specified Peer interface to create a new Button. createCanvas(Canvas). Method in class java.awt.Toolkit Uses the specified Peer interface to create a new Canvas. createCheckbox(Checkbox). Method in class java.awt.Toolkit Uses the specified Peer interface to create a new Checkbox. createCheckboxMenuItem(CheckboxMenuItem). Method in class java.awt.Toolkit Uses the specified Peer interface to create a new CheckboxMenuItem. createChoice(Choice). Method in class java.awt.Toolkit Uses the specified Peer interface to create a new Choice. createComponent(Component). Method in class java.awt.Toolkit Creates a peer for a component or container. createContentHandler(String). Method in interface java.net.ContentHandlerFactory Creates a new ContentHandler to read an object from a URLStreamHandler. createDialog(Dialog). Method in class java.awt.Toolkit Uses the specified Peer interface to create a new Dialog. createFileDialog(FileDialog). Method in class java.awt.Toolkit Uses the specified Peer interface to create a new FileDialog. createFrame(Frame). Method in class java.awt.Toolkit Uses the specified Peer interface to create a new Frame. createImage(byte[]). Method in class java.awt.Toolkit Creates an image which decodes the image stored in the specified byte array. createImage(byte[], int, int). Method in class java.awt.Toolkit Creates an image which decodes the image stored in the specified byte array at the specified offset and length. createImage(ImageProducer). Method in class java.awt.Component Creates an image from the specified image producer. createImage(ImageProducer). Method in interface java.awt.peer.ComponentPeer createImage(ImageProducer). Method in class java.awt.Toolkit Creates an image with the specified image producer. createImage(int, int). Method in class java.awt.Component Creates an off-screen drawable Image to be used for double buffering. createImage(int, int). Method in interface java.awt.peer.ComponentPeer createLabel(Label). Method in class java.awt.Toolkit Uses the specified Peer interface to create a new Label. createList(List). Method in class java.awt.Toolkit Uses the specified Peer interface to create a new List. createMenu(Menu). Method in class java.awt.Toolkit Uses the specified Peer interface to create a new Menu. createMenuBar(MenuBar). Method in class java.awt.Toolkit Uses the specified Peer interface to create a new MenuBar. createMenuItem(MenuItem). Method in class java.awt.Toolkit Uses the specified Peer interface to create a new MenuItem. createPanel(Panel). Method in class java.awt.Toolkit Uses the specified Peer interface to create a new Panel. createPopupMenu(PopupMenu). Method in class java.awt.Toolkit Uses the specified Peer interface to create a new PopupMenu. createRegistry(int). Static method in class java.rmi.registry.LocateRegistry Create and export a registry on the local host. createScrollbar(Scrollbar). Method in class java.awt.Toolkit Uses the specified Peer interface to create a new Scrollbar. createScrollPane(ScrollPane). Method in class java.awt.Toolkit Uses the specified Peer interface to create a new scrolling container. createServerSocket(int). Method in class java.rmi.server.RMISocketFactory Create a server socket on the specified port (port 0 represents an anonymous port). createSocket(String, int). Method in class java.rmi.server.RMISocketFactory Create a client socket connected to the specified host and port. createSocketImpl(). Method in interface java.net.SocketImplFactory Creates a new SocketImpl instance. createStatement(). Method in interface java.sql.Connection

ww w. ja

va
310

dil

i.c o

m

311
SQL statements without parameters are normally executed using Statement objects. createTextArea(TextArea). Method in class java.awt.Toolkit Uses the specified Peer interface to create a new TextArea. createTextField(TextField). Method in class java.awt.Toolkit Uses the specified Peer interface to create a new TextField. createURLStreamHandler(String). Method in interface java.net.URLStreamHandlerFactory Creates a new URLStreamHandler instance with the specified protocol. createWindow(Window). Method in class java.awt.Toolkit Uses the specified Peer interface to create a new Window. CropImageFilter(int, int, int, int). Constructor for class java.awt.image.CropImageFilter Constructs a CropImageFilter that extracts the absolute rectangular region of pixels from its source Image as specified by the x, y, w, and h parameters. CROSSHAIR_CURSOR. Static variable in class java.awt.Cursor The crosshair cursor type. CROSSHAIR_CURSOR. Static variable in class java.awt.Frame CTRL_MASK. Static variable in class java.awt.event.ActionEvent The control modifier constant. CTRL_MASK. Static variable in class java.awt.Event The control modifier constant. CTRL_MASK. Static variable in class java.awt.event.InputEvent The control key modifier constant. CURRENCY_SYMBOL. Static variable in class java.lang.Character current(). Method in class java.text.BreakIterator Return character index of the text boundary that was most recently returned by next(), previous(), first(), or last() current(). Method in interface java.text.CharacterIterator Get the character at the current position (as returned by getIndex()). current(). Method in class java.text.StringCharacterIterator Get the character at the current position (as returned by getIndex()). currentClassLoader(). Method in class java.lang.SecurityManager Returns an object describing the most recent class loader executing on the stack. currentLoadedClass(). Method in class java.lang.SecurityManager Returns the current Class with a ClassLoader on the execution stack. currentThread(). Static method in class java.lang.Thread Returns a reference to the currently executing thread object. currentTimeMillis(). Static method in class java.lang.System Returns the current time in milliseconds. Cursor(int). Constructor for class java.awt.Cursor Creates a new cursor object with the specified type. cyan. Static variable in class java.awt.Color The color cyan.

D

ww w. ja
The returned DataFlavor will have the following characteristics representationClass = representationClass mimeType = application/x-javaserializedobject The returned DataFlavor will have the following characteristics: otherwise: representationClass = InputStream mimeType = mimeType

darker(). Method in class java.awt.Color Returns a darker version of this color. darkGray. Static variable in class java.awt.Color The color dark gray. DASH_PUNCTUATION. Static variable in class java.lang.Character dataDefinitionCausesTransactionCommit(). Method in interface java.sql.DatabaseMetaData Does a data definition statement within a transaction force the transaction to commit? dataDefinitionIgnoredInTransactions(). Method in interface java.sql.DatabaseMetaData Is a data definition statement within a transaction ignored? DataFlavor(Class, String). Constructor for class java.awt.datatransfer.DataFlavor Construct a DataFlavor that represents a Java class

DataFlavor(String, String). Constructor for class java.awt.datatransfer.DataFlavor Construct a DataFlavor that represents a MimeType

If the mimeType is "application/x-javaserializedobject; class=", the result is the same as calling new DataFlavor(Class:forName() as above

DataFormatException(). Constructor for class java.util.zip.DataFormatException

va
311

dil

i.c o

m

312
Constructs a DataFormatException with no detail message. DataFormatException(String). Constructor for class java.util.zip.DataFormatException Constructs a DataFormatException with the specified detail message. DatagramPacket(byte[], int). Constructor for class java.net.DatagramPacket Constructs a DatagramPacket for receiving packets of length ilength. DatagramPacket(byte[], int, InetAddress, int). Constructor for class java.net.DatagramPacket Constructs a datagram packet for sending packets of length ilength to the specified port number on the specified host. DatagramSocket(). Constructor for class java.net.DatagramSocket Constructs a datagram socket and binds it to any available port on the local host machine. DatagramSocket(int). Constructor for class java.net.DatagramSocket Constructs a datagram socket and binds it to the specified port on the local host machine. DatagramSocket(int, InetAddress). Constructor for class java.net.DatagramSocket Creates a datagram socket, bound to the specified local address. DatagramSocketImpl(). Constructor for class java.net.DatagramSocketImpl DataInputStream(InputStream). Constructor for class java.io.DataInputStream Creates a new data input stream to read data from the specified input stream. DataOutputStream(OutputStream). Constructor for class java.io.DataOutputStream Creates a new data output stream to write data to the specified underlying output stream. DataTruncation(int, boolean, boolean, int, int). Constructor for class java.sql.DataTruncation

ww w. ja

Create a DataTruncation object. DATE. Static variable in class java.util.Calendar Useful constant for date and time. DATE. Static variable in class java.sql.Types Date(). Constructor for class java.util.Date Allocates a Date object and initializes it so that it represents the time at which it was allocated measured to the nearest millisecond. Date(int, int, int). Constructor for class java.sql.Date Construct a Date Date(int, int, int). Constructor for class java.util.Date Allocates a Date object and initializes it so that it represents midnight, local time, at the beginning of the day specified by the year, month, and date arguments. Date(int, int, int, int, int). Constructor for class java.util.Date Allocates a Date object and initializes it so that it represents the specified hour and minute, local time, of the date specified by the year, month, date, hrs, and min arguments. Date(int, int, int, int, int, int). Constructor for class java.util.Date Allocates a Date object and initializes it so that it represents the specified hour, minute, and second, local time of the date specified by the year, month, date, hrs, min, and sec arguments. Date(long). Constructor for class java.sql.Date Construct a Date using a milliseconds time value Date(long). Constructor for class java.util.Date Allocates a Date object and initializes it to represent the specified number of milliseconds since January 1, 1970, 00:00:00 GMT. Date(String). Constructor for class java.util.Date Allocates a Date object and initializes it so that it represents the date and time indicated by the string s, which is interpreted as if by the parse method. DATE_FIELD. Static variable in class java.text.DateFormat Useful constant for DATE field alignment. DateFormat(). Constructor for class java.text.DateFormat DateFormatSymbols(). Constructor for class java.text.DateFormatSymbols Construct a DateFormatSymbols object by loading format data from resources for the default locale. DateFormatSymbols(Locale). Constructor for class java.text.DateFormatSymbols Construct a DateFormatSymbols object by loading format data from resources for the given locale. DAY_OF_MONTH. Static variable in class java.util.Calendar Useful constant for date and time. DAY_OF_WEEK. Static variable in class java.util.Calendar Useful constant for date and time. DAY_OF_WEEK_FIELD. Static variable in class java.text.DateFormat Useful constant for DAY_OF_WEEK field alignment. DAY_OF_WEEK_IN_MONTH. Static variable in class java.util.Calendar Useful constant for date and time. DAY_OF_WEEK_IN_MONTH_FIELD. Static variable in class java.text.DateFormat Useful constant for DAY_OF_WEEK_IN_MONTH field alignment. DAY_OF_YEAR. Static variable in class java.util.Calendar Useful constant for date and time. DAY_OF_YEAR_FIELD. Static variable in class java.text.DateFormat Useful constant for DAY_OF_YEAR field alignment. decapitalize(String). Static method in class java.beans.Introspector Utility method to take a string and convert it to normal Java variable name capitalization. DECEMBER. Static variable in class java.util.Calendar Useful constant for month. DECIMAL. Static variable in class java.sql.Types DECIMAL_DIGIT_NUMBER. Static variable in class java.lang.Character DecimalFormat(). Constructor for class java.text.DecimalFormat Create a DecimalFormat using the default pattern and symbols for the default locale. DecimalFormat(String). Constructor for class java.text.DecimalFormat

va
312

dil

i.c o

m

313
Create a DecimalFormat from the given pattern and the symbols for the default locale. DecimalFormat(String, DecimalFormatSymbols). Constructor for class java.text.DecimalFormat Create a DecimalFormat from the given pattern and symbols. DecimalFormatSymbols(). Constructor for class java.text.DecimalFormatSymbols Create a DecimalFormatSymbols object for the default locale. DecimalFormatSymbols(Locale). Constructor for class java.text.DecimalFormatSymbols Create a DecimalFormatSymbols object for the given locale. DECLARED. Static variable in interface java.lang.reflect.Member Identifies the set of declared members of a class or interface. decode(InputStream). Method in interface java.security.Certificate Decodes a certificate from an input stream. decode(String). Static method in class java.lang.Byte Decodes a String into a Byte. decode(String). Static method in class java.awt.Color Gets the specified Color. decode(String). Static method in class java.awt.Font Gets the specified font using the name passed in. decode(String). Static method in class java.lang.Integer Decodes a string into an Integer. decode(String). Static method in class java.lang.Short Decodes a String into a Short. def. Variable in class java.util.zip.DeflaterOutputStream Compressor for this stream. DEFAULT. Static variable in class java.text.DateFormat Constant for default style pattern. DEFAULT_COMPRESSION. Static variable in class java.util.zip.Deflater Default compression level. DEFAULT_CURSOR. Static variable in class java.awt.Cursor The default cursor type (gets set if no cursor is defined). DEFAULT_CURSOR. Static variable in class java.awt.Frame DEFAULT_STRATEGY. Static variable in class java.util.zip.Deflater Default compression strategy. defaultConstraints. Variable in class java.awt.GridBagLayout defaultReadObject(). Method in class java.io.ObjectInputStream Read the non-static and non-transient fields of the current class from this stream. defaults. Variable in class java.util.Properties A property list that contains default values for any keys not found in this property list. defaultWriteObject(). Method in class java.io.ObjectOutputStream Write the non-static and non-transient fields of the current class to this stream. defineClass(byte[], int, int). Method in class java.lang.ClassLoader Converts an array of bytes into an instance of class Class. defineClass(String, byte[], int, int). Method in class java.lang.ClassLoader Converts an array of bytes to an instance of class Class. deflate(). Method in class java.util.zip.DeflaterOutputStream Writes next block of compressed data to the output stream. deflate(byte[]). Method in class java.util.zip.Deflater Fills specified buffer with compressed data. deflate(byte[], int, int). Method in class java.util.zip.Deflater Fills specified buffer with compressed data. DEFLATED. Static variable in class java.util.zip.Deflater Compression method for the deflate algorithm (the only one currently supported). DEFLATED. Static variable in class java.util.zip.ZipEntry Compression method for compressed (deflated) entries. DEFLATED. Static variable in class java.util.zip.ZipOutputStream Compression method for compressed (DEFLATED) entries. Deflater(). Constructor for class java.util.zip.Deflater Creates a new compressor with the default compression level. Deflater(int). Constructor for class java.util.zip.Deflater Creates a new compressor using the specified compression level. Deflater(int, boolean). Constructor for class java.util.zip.Deflater Creates a new compressor using the specified compression level. DeflaterOutputStream(OutputStream). Constructor for class java.util.zip.DeflaterOutputStream Creates a new output stream with a defaul compressor and buffer size. DeflaterOutputStream(OutputStream, Deflater). Constructor for class java.util.zip.DeflaterOutputStream Creates a new output stream with the specified compressor and a default buffer size. DeflaterOutputStream(OutputStream, Deflater, int). Constructor for class java.util.zip.DeflaterOutputStream Creates a new output stream with the specified compressor and buffer size. DELETE. Static variable in class java.awt.Event The Delete key. delete(). Method in class java.io.File Deletes the file specified by this object. deleteObserver(Observer). Method in class java.util.Observable Deletes an observer from the set of observers of this object. deleteObservers(). Method in class java.util.Observable Clears the observer list so that this object no longer has any observers. deleteOwner(Principal, Principal). Method in interface java.security.acl.Owner

ww w. ja

va
313

dil

i.c o

m

314
Deletes an owner. deleteShortcut(). Method in class java.awt.MenuItem Delete any MenuShortcut associated with this MenuItem. deleteShortcut(MenuShortcut). Method in class java.awt.MenuBar Delete the specified MenuShortcut. delItem(int). Method in class java.awt.List Removes an item from the list. delItem(int). Method in interface java.awt.peer.MenuPeer delItems(int, int). Method in class java.awt.List delItems(int, int). Method in interface java.awt.peer.ListPeer deliverEvent(Event). Method in class java.awt.Component deliverEvent(Event). Method in class java.awt.Container delMenu(int). Method in interface java.awt.peer.MenuBarPeer deregisterDriver(Driver). Static method in class java.sql.DriverManager Drop a Driver from the DriverManager's list. description. Variable in class java.sql.DriverPropertyInfo A brief description of the property. description(). Method in class sun.tools.debug.RemoteArray Return a description of the array. description(). Method in class sun.tools.debug.RemoteClass Return a (somewhat verbose) description. description(). Method in class sun.tools.debug.RemoteObject Return a description of the object. description(). Method in class sun.tools.debug.RemoteString Return the string value, or "null" description(). Method in class sun.tools.debug.RemoteValue Return a description of the RemoteValue. deselect(int). Method in class java.awt.List Deselects the item at the specified index. deselect(int). Method in interface java.awt.peer.ListPeer DESELECTED. Static variable in class java.awt.event.ItemEvent The item de-selected state change type. DESKTOP. Static variable in class java.awt.SystemColor The array index for the desktop background color. desktop. Static variable in class java.awt.SystemColor The color of the desktop background. destHeight. Variable in class java.awt.image.ReplicateScaleFilter destroy(). Method in class java.applet.Applet Called by the browser or applet viewer to inform this applet that it is being reclaimed and that it should destroy any resources that it has allocated. destroy(). Method in class java.lang.Process Kills the subprocess. destroy(). Method in class java.lang.Thread Destroys this thread, without any cleanup. destroy(). Method in class java.lang.ThreadGroup Destroys this thread group and all of its subgroups. destWidth. Variable in class java.awt.image.ReplicateScaleFilter detail. Variable in class java.rmi.RemoteException detail. Variable in class java.rmi.server.ServerCloneException detail. Variable in class java.io.WriteAbortedException DGC_ID. Static variable in class java.rmi.server.ObjID well-known id for the distributed garbage collector Dialog(Frame). Constructor for class java.awt.Dialog Constructs an initially invisible Dialog with an empty title. Dialog(Frame, boolean). Constructor for class java.awt.Dialog Constructs an initially invisible Dialog with an empty title. Dialog(Frame, String). Constructor for class java.awt.Dialog Constructs an initially invisible Dialog with a title. Dialog(Frame, String, boolean). Constructor for class java.awt.Dialog Constructs an initially invisible Dialog with a title. Dictionary(). Constructor for class java.util.Dictionary digest. Variable in class java.security.DigestInputStream The message digest associated with this stream. digest. Variable in class java.security.DigestOutputStream The message digest associated with this stream. digest(). Method in class java.security.MessageDigest Completes the hash computation by performing final operations such as padding. digest(byte[]). Method in class java.security.MessageDigest Performs a final update on the digest using the specified array of bytes, then completes the digest computation. DigestException(). Constructor for class java.security.DigestException Constructs a DigestException with no detail message. DigestException(String). Constructor for class java.security.DigestException Constructs a DigestException with the specified detail message. DigestInputStream(InputStream, MessageDigest). Constructor for class java.security.DigestInputStream Creates a digest input stream, using the specified input stream and message digest. DigestOutputStream(OutputStream, MessageDigest). Constructor for class java.security.DigestOutputStream

ww w. ja

va
314

dil

i.c o

m

315
Creates a digest output stream, using the specified output stream and message digest. digit(char, int). Static method in class java.lang.Character Returns the numeric value of the character ch in the specified radix. Dimension(). Constructor for class java.awt.Dimension Constructs a Dimension object with 0 width and 0 height. Dimension(Dimension). Constructor for class java.awt.Dimension Constructs a Dimension and initializes it to the specified value. Dimension(int, int). Constructor for class java.awt.Dimension Constructs a Dimension and initializes it to the specified width and specified height. DirectColorModel(int, int, int, int). Constructor for class java.awt.image.DirectColorModel Constructs a DirectColorModel from the given masks specifying which bits in the pixel contain the red, green and blue color components. DirectColorModel(int, int, int, int, int). Constructor for class java.awt.image.DirectColorModel Constructs a DirectColorModel from the given masks specifying which bits in the pixel contain the alhpa, red, green and blue color components. dirty(ObjID[], long, Lease). Method in interface java.rmi.dgc.DGC The dirty call requests leases for the remote object references associated with the object identifiers contained in the array 'ids'. disable(). Static method in class java.lang.Compiler Cause the Compiler to cease operation. disable(). Method in class java.awt.Component disable(). Method in interface java.awt.peer.ComponentPeer DEPRECATED: Replaced by setEnabled(boolean). disable(). Method in class java.awt.MenuItem disable(). Method in interface java.awt.peer.MenuItemPeer DEPRECATED: Replaced by setEnabled(boolean). disableEvents(long). Method in class java.awt.Component Disables the events defined by the specified event mask parameter from being delivered to this component. disableEvents(long). Method in class java.awt.MenuItem Disables the events defined by the specified event mask parameter from being delivered to this menu item. disconnect(). Method in class java.net.HttpURLConnection Close the connection to the server. dispatch(Remote, RemoteCall, int, long). Method in interface java.rmi.server.Skeleton Unmarshals arguments, calls the actual remote object implementation, and marshals the return value or any exception. dispatchEvent(AWTEvent). Method in class java.awt.Component Dispatches an event to this component or one of its sub components. dispatchEvent(AWTEvent). Method in class java.awt.MenuComponent dispose(). Method in interface java.awt.peer.ComponentPeer dispose(). Method in class java.awt.Frame Disposes of the Frame. dispose(). Method in class java.awt.Graphics Dispose of the system resources used by this graphics context. dispose(). Method in interface java.awt.peer.MenuComponentPeer dispose(). Method in class java.awt.Window Disposes of the Window. divide(BigDecimal, int). Method in class java.math.BigDecimal Returns a BigDecimal whose value is (this / val), and whose scale is this.scale(). divide(BigDecimal, int, int). Method in class java.math.BigDecimal Returns a BigDecimal whose value is (this / val), and whose scale is as specified. divide(BigInteger). Method in class java.math.BigInteger Returns a BigInteger whose value is (this / val). divideAndRemainder(BigInteger). Method in class java.math.BigInteger Returns an array of two BigIntegers. doesMaxRowSizeIncludeBlobs(). Method in interface java.sql.DatabaseMetaData Did getMaxRowSize() include LONGVARCHAR and LONGVARBINARY blobs? doInput. Variable in class java.net.URLConnection This variable is set by the setDoInput method. doLayout(). Method in class java.awt.Component Lays out the component. doLayout(). Method in class java.awt.Container Does a layout on this Container. doLayout(). Method in class java.awt.ScrollPane Lays out this container by resizing its child to its preferred size. DONE. Static variable in class java.text.BreakIterator DONE is returned by previous() and next() after all valid boundaries have been returned. DONE. Static variable in interface java.text.CharacterIterator Constant that is returned when the iterator has reached either the end or the beginning of the text. done(). Method in interface java.rmi.server.RemoteCall Allow cleanup after the remote call has completed. done(RemoteCall). Method in interface java.rmi.server.RemoteRef Allows the remote reference to clean up (or reuse) the connection. dontUseGui(). Method in interface java.beans.Visibility This method instructs the bean that it should not use the Gui. doOutput. Variable in class java.net.URLConnection This variable is set by the setDoOutput method. DOUBLE. Static variable in class java.sql.Types Double(double). Constructor for class java.lang.Double

ww w. ja

va
315

dil

i.c o

m

316
Constructs a newly allocated Double object that represents the primitive double argument. Double(String). Constructor for class java.lang.Double Constructs a newly allocated Double object that represents the floating- point value of type double represented by the string. doubleToLongBits(double). Static method in class java.lang.Double Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "double format" bit layout. doubleValue(). Method in class java.math.BigDecimal Converts the number to a double. doubleValue(). Method in class java.math.BigInteger Converts the number to a double. doubleValue(). Method in class java.lang.Byte Returns the value of this Byte as a double. doubleValue(). Method in class java.lang.Double Returns the double value of this Double. doubleValue(). Method in class java.lang.Float Returns the double value of this Float. doubleValue(). Method in class java.lang.Integer Returns the value of this Integer as a double. doubleValue(). Method in class java.lang.Long Returns the value of this Long as a double. doubleValue(). Method in class java.lang.Number Returns the value of the specified number as a double. doubleValue(). Method in class java.lang.Short Returns the value of this Short as a double. DOWN. Static variable in class java.awt.Event The down arrow action-key. down(int). Method in class sun.tools.debug.RemoteThread Change the current stackframe to be one or more frames lower (as in, toward the current program counter). drain(). Method in class java.io.ObjectOutputStream Drain any buffered data in ObjectOutputStream. draw3DRect(int, int, int, int, boolean). Method in class java.awt.Graphics Draws a 3-D highlighted outline of the specified rectangle. drawArc(int, int, int, int, int, int). Method in class java.awt.Graphics Draws the outline of an arc covering the specified rectangle, starting at startAngle and extending for arcAngle degrees, using the current color. drawBytes(byte[], int, int, int, int). Method in class java.awt.Graphics Draws the specified bytes using the current font and color. drawChars(char[], int, int, int, int). Method in class java.awt.Graphics Draws the specified characters using the current font and color. drawImage(Image, int, int, Color, ImageObserver). Method in class java.awt.Graphics Draws as much of the specified image as is currently available at the specified coordinate (x, y) with the given solid background color. drawImage(Image, int, int, ImageObserver). Method in class java.awt.Graphics Draws as much of the specified image as is currently available at the specified coordinate (x, y). drawImage(Image, int, int, int, int, Color, ImageObserver). Method in class java.awt.Graphics Draws as much of the specified image as has already been scaled to fit inside the specified rectangle with the given solid background color. drawImage(Image, int, int, int, int, ImageObserver). Method in class java.awt.Graphics Draws as much of the specified image as has already been scaled to fit inside the specified rectangle. drawImage(Image, int, int, int, int, int, int, int, int, Color, ImageObserver). Method in class java.awt.Graphics Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the specified area of the destination drawable surface with the given solid background color. drawImage(Image, int, int, int, int, int, int, int, int, ImageObserver). Method in class java.awt.Graphics Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the specified area of the destination drawable surface. drawLine(int, int, int, int). Method in class java.awt.Graphics Draws a line between the coordinates (x1,y1) and (x2,y2) using the current color. drawOval(int, int, int, int). Method in class java.awt.Graphics Draws the outline of an oval covering the specified rectangle using the current color. drawPolygon(int[], int[], int). Method in class java.awt.Graphics Draws the outline of a polygon defined by arrays of x coordinates and y coordinates using the current color. drawPolygon(Polygon). Method in class java.awt.Graphics Draws the outline of a polygon defined by the specified Polygon object using the current color. drawPolyline(int[], int[], int). Method in class java.awt.Graphics Draws a sequence of connected lines defined by arrays of x coordinates and y coordinates using the current color. drawRect(int, int, int, int). Method in class java.awt.Graphics Draws the outline of the specified rectangle using the current color. drawRoundRect(int, int, int, int, int, int). Method in class java.awt.Graphics Draws the outline of the specified rounded corner rectangle using the current color. drawString(String, int, int). Method in class java.awt.Graphics Draws the specified String using the current font and color. DriverPropertyInfo(String, String). Constructor for class java.sql.DriverPropertyInfo Constructor a DriverPropertyInfo with a name and value; other members default to their initial values. DST_OFFSET. Static variable in class java.util.Calendar Useful constant for date and time.

ww w. ja

va
316

dil

i.c o

m

317
dumpStack(). Method in class sun.tools.debug.RemoteThread Dump the stack. dumpStack(). Static method in class java.lang.Thread Prints a stack trace of the current thread.

E

ww w. ja

E. Static variable in class java.lang.Math The double value that is closer than any other to e, the base of the natural logarithms. E_RESIZE_CURSOR. Static variable in class java.awt.Cursor The east-resize cursor type. E_RESIZE_CURSOR. Static variable in class java.awt.Frame EAST. Static variable in class java.awt.BorderLayout The east layout constraint. EAST. Static variable in class java.awt.GridBagConstraints echoCharIsSet(). Method in class java.awt.TextField Returns true if this TextField has a character set for echoing. elementAt(int). Method in class java.util.Vector Returns the component at the specified index. elementCount. Variable in class java.util.Vector The number of valid components in the vector. elementData. Variable in class java.util.Vector The array buffer into which the components of the vector are stored. elements(). Method in class java.util.Dictionary Returns an enumeration of the values in this dictionary. elements(). Method in class java.util.Hashtable Returns an enumeration of the values in this hashtable. elements(). Method in class java.util.Vector Returns an enumeration of the components of this vector. empty(). Method in class java.util.Stack Tests if this stack is empty. EmptyStackException(). Constructor for class java.util.EmptyStackException Constructs a new EmptyStackException with no detail message. enable(). Static method in class java.lang.Compiler Cause the Compiler to resume operation. enable(). Method in class java.awt.Component enable(). Method in interface java.awt.peer.ComponentPeer DEPRECATED: Replaced by setEnabled(boolean). enable(). Method in class java.awt.MenuItem enable(). Method in interface java.awt.peer.MenuItemPeer DEPRECATED: Replaced by setEnabled(boolean). enable(boolean). Method in class java.awt.Component enable(boolean). Method in class java.awt.MenuItem enableEvents(long). Method in class java.awt.Component Enables the events defined by the specified event mask parameter to be delivered to this component. enableEvents(long). Method in class java.awt.MenuItem Enables the events defined by the specified event mask parameter to be delivered to this menu item. enableReplaceObject(boolean). Method in class java.io.ObjectOutputStream Enable the stream to do replacement of objects in the stream. enableResolveObject(boolean). Method in class java.io.ObjectInputStream Enable the stream to allow objects read from the stream to be replaced. ENCLOSING_MARK. Static variable in class java.lang.Character encode(OutputStream). Method in interface java.security.Certificate Encodes the certificate to an output stream in a format that can be decoded by the decode method. encode(String). Static method in class java.net.URLEncoder Translates a string into x-www-form-urlencoded format. END. Static variable in class java.awt.Event The end action-key. end(). Method in class java.util.zip.Deflater Discards unprocessed input and frees internal data. end(). Method in class java.util.zip.Inflater Discards unprocessed input and frees internal data. end(). Method in class java.awt.PrintJob Ends the print job and does any necessary cleanup. END_PUNCTUATION. Static variable in class java.lang.Character endsWith(String). Method in class java.lang.String Tests if this string ends with the specified suffix. endValidate(). Method in interface java.awt.peer.ContainerPeer engineDigest(). Method in class java.security.MessageDigest SPI: Completes the hash computation by performing final operations such as padding. engineGetParameter(String). Method in class java.security.Signature SPI: Gets the value of the specified algorithm parameter. engineInitSign(PrivateKey). Method in class java.security.Signature SPI: Initializes this signature object with the specified private key for signing operations.

va
317

dil

i.c o

m

318
engineInitVerify(PublicKey). Method in class java.security.Signature SPI: Initializes this signature object with the specified public key for verification operations. engineReset(). Method in class java.security.MessageDigest SPI: Resets the digest for further use. engineSetParameter(String, Object). Method in class java.security.Signature SPI: Sets the specified algorithm parameter to the specified value. engineSign(). Method in class java.security.Signature SPI: Returns the signature bytes of all the data updated so far. engineUpdate(byte). Method in class java.security.MessageDigest SPI: Updates the digest using the specified byte. engineUpdate(byte). Method in class java.security.Signature SPI: Updates the data to be signed or verified using the specified byte. engineUpdate(byte[], int, int). Method in class java.security.MessageDigest SPI: Updates the digest using the specified array of bytes, starting at the specified offset. engineUpdate(byte[], int, int). Method in class java.security.Signature SPI: Updates the data to be signed or verified, using the specified array of bytes, starting at the specified offset. engineVerify(byte[]). Method in class java.security.Signature SPI: Verifies the passed-in signature. ENGLISH. Static variable in class java.util.Locale Useful constant for language. ensureCapacity(int). Method in class java.lang.StringBuffer Ensures that the capacity of the buffer is at least equal to the specified minimum. ensureCapacity(int). Method in class java.util.Vector Increases the capacity of this vector, if necessary, to ensure that it can hold at least the number of components specified by the minimum capacity argument. ENTER. Static variable in class java.awt.Event The Enter key. entries(). Method in interface java.security.acl.Acl Returns an enumeration of the entries in this ACL. entries(). Method in class java.util.zip.ZipFile Returns an enumeration of the ZIP file entries. enumerate(Thread[]). Static method in class java.lang.Thread Copies into the specified array every active thread in this thread group and its subgroups. enumerate(Thread[]). Method in class java.lang.ThreadGroup Copies into the specified array every active thread in this thread group and its subgroups. enumerate(Thread[], boolean). Method in class java.lang.ThreadGroup Copies into the specified array every active thread in this thread group. enumerate(ThreadGroup[]). Method in class java.lang.ThreadGroup Copies into the specified array references to every active subgroup in this thread group. enumerate(ThreadGroup[], boolean). Method in class java.lang.ThreadGroup Copies into the specified array references to every active subgroup in this thread group. eof. Variable in class java.io.OptionalDataException True if there is not more data in the buffered part of the stream. EOFException(). Constructor for class java.io.EOFException Constructs an EOFException with no detail message. EOFException(String). Constructor for class java.io.EOFException Constructs an EOFException with the specified detail message. eolIsSignificant(boolean). Method in class java.io.StreamTokenizer Determines whether or not ends of line are treated as tokens. eos. Variable in class java.util.zip.GZIPInputStream Indicates end of input stream. equals(DataFlavor). Method in class java.awt.datatransfer.DataFlavor equals(MenuShortcut). Method in class java.awt.MenuShortcut Returns whether this MenuShortcut is the same as another: equality is defined to mean that both MenuShortcuts use the same key and both either use or don't use the SHIFT key. equals(Object). Method in class java.math.BigDecimal Returns true iff x is a BigDecimal whose value is equal to this number. equals(Object). Method in class java.math.BigInteger Returns true iff x is a BigInteger whose value is equal to this number. equals(Object). Method in class java.util.BitSet Compares this object against the specified object. equals(Object). Method in class java.lang.Boolean Returns true if and only if the argument is not null and is a Boolean object that contains the same boolean value as this object. equals(Object). Method in class java.lang.Byte Compares this object to the specified object. equals(Object). Method in class java.util.Calendar Compares the time field records. equals(Object). Method in class java.lang.Character Compares this object against the specified object. equals(Object). Method in class java.text.ChoiceFormat Equality comparision between two equals(Object). Method in class java.text.CollationKey Compare this CollationKey and the target CollationKey for equality. equals(Object). Method in class java.text.Collator Compares the equality of two Collators.

ww w. ja

va
318

dil

i.c o

m

319
equals(Object). Method in class java.awt.Color Compares this object against the specified object. equals(Object). Method in class java.lang.reflect.Constructor Compares this Constructor against the specified object. equals(Object). Method in class java.util.Date Compares two dates. equals(Object). Method in class java.text.DateFormat Overrides equals equals(Object). Method in class java.text.DateFormatSymbols Override equals equals(Object). Method in class java.text.DecimalFormat Overrides equals equals(Object). Method in class java.text.DecimalFormatSymbols Override equals equals(Object). Method in class java.awt.Dimension Checks whether two dimension objects have equal values. equals(Object). Method in class java.lang.Double Compares this object against the specified object. equals(Object). Method in class java.lang.reflect.Field Compares this Field against the specified object. equals(Object). Method in class java.io.File Compares this object against the specified object. equals(Object). Method in class java.lang.Float Compares this object against some other object. equals(Object). Method in class java.awt.Font Compares this object to the specifed object. equals(Object). Method in class java.util.GregorianCalendar Overrides Calendar Compares the time field records. equals(Object). Method in class java.security.Identity Tests for equality between the specified object and this identity. equals(Object). Method in class java.net.InetAddress Compares this object against the specified object. equals(Object). Method in class java.awt.Insets Checks whether two insets objects are equal. equals(Object). Method in class java.lang.Integer Compares this object to the specified object. equals(Object). Method in class java.util.Locale Compares two Objects for equality. equals(Object). Method in class java.lang.Long Compares this object against the specified object. equals(Object). Method in class java.text.MessageFormat Equality comparision between two message format objects equals(Object). Method in class java.lang.reflect.Method Compares this Method against the specified object. equals(Object). Method in class java.text.NumberFormat Overrides equals equals(Object). Method in class java.lang.Object Compares two Objects for equality. equals(Object). Method in class java.rmi.server.ObjID Two object identifiers are considered equal if they have the same contents. equals(Object). Method in interface java.security.acl.Permission Returns true if the object passed matches the permission represented in this interface. equals(Object). Method in class java.awt.Point Checks whether two pointers are equal. equals(Object). Method in interface java.security.Principal Compares this principal to the specified object. equals(Object). Method in class java.awt.Rectangle Checks whether two rectangles are equal. equals(Object). Method in class java.rmi.server.RemoteObject Compares two remote objects for equality. equals(Object). Method in class java.text.RuleBasedCollator Compares the equality of two collation objects. equals(Object). Method in class java.lang.Short Compares this object to the specified object. equals(Object). Method in class java.text.SimpleDateFormat Override equals. equals(Object). Method in class java.util.SimpleTimeZone Compares the equality of two SimpleTimeZone objects. equals(Object). Method in class java.lang.String Compares this string to the specified object. equals(Object). Method in class java.text.StringCharacterIterator Compares the equality of two StringCharacterIterator objects. equals(Object). Method in class java.rmi.server.UID Compares two Objects for equality. equals(Object). Method in class java.net.URL Compares two URLs.

ww w. ja

va
319

dil

i.c o

m

320
equals(Object). Method in class java.rmi.dgc.VMID Compare this VMID to another, and return true if they are the same identifier. equals(String, String). Method in class java.text.Collator Convenience method for comparing the equality of two strings based on this Collator's collation rules. equals(Timestamp). Method in class java.sql.Timestamp Test Timestamp values for equality equalsIgnoreCase(String). Method in class java.lang.String Compares this String to another object. ERA. Static variable in class java.util.Calendar Useful constant for date and time. ERA_FIELD. Static variable in class java.text.DateFormat Useful constant for ERA field alignment. err. Static variable in class java.io.FileDescriptor A handle to the standard error stream. err. Static variable in class java.lang.System The "standard" error output stream. ERROR. Static variable in interface java.awt.image.ImageObserver An image which was being tracked asynchronously has encountered an error. Error(). Constructor for class java.lang.Error Constructs an Error with no specified detail message. Error(String). Constructor for class java.lang.Error Constructs an Error with the specified detail message. ERRORED. Static variable in class java.awt.MediaTracker Flag indicating the download of some media encountered an error. ESCAPE. Static variable in class java.awt.Event The Escape key. Event(Object, int, Object). Constructor for class java.awt.Event Constructs an event with the specified target component, event type, and argument. Event(Object, long, int, int, int, int, int). Constructor for class java.awt.Event Constructs an event with the specified target component, time stamp, event type, x and y coordinates, keyboard key, state of the modifier keys and an argument set to null. Event(Object, long, int, int, int, int, int, Object). Constructor for class java.awt.Event Constructs an event with the specified target component, time stamp, event type, x and y coordinates, keyboard key, state of the modifier keys and argument. EventObject(Object). Constructor for class java.util.EventObject EventObject(Object). Constructor for class sunw.util.EventObject EventQueue(). Constructor for class java.awt.EventQueue EventSetDescriptor(Class, String, Class, String). Constructor for class java.beans.EventSetDescriptor This constructor creates an EventSetDescriptor assuming that you are following the most simple standard design pattern where a named event "fred" is (1) delivered as a call on the single method of interface FredListener, (2) has a single argument of type FredEvent, and (3) where the FredListener may be registered with a call on an addFredListener method of the source component and removed with a call on a removeFredListener method. EventSetDescriptor(Class, String, Class, String[], String, String). Constructor for class java.beans.EventSetDescriptor This constructor creates an EventSetDescriptor from scratch using string names. EventSetDescriptor(String, Class, Method[], Method, Method). Constructor for class java.beans.EventSetDescriptor This constructor creates an EventSetDescriptor from scratch using java.lang.reflect.Method and java.lang.Class objects. EventSetDescriptor(String, Class, MethodDescriptor[], Method, Method). Constructor for class java.beans.EventSetDescriptor This constructor creates an EventSetDescriptor from scratch using java.lang.reflect.MethodDescriptor and java.lang.Class objects. evt. Variable in class java.awt.Event The next event. Exception(). Constructor for class java.lang.Exception Constructs an Exception with no specified detail message. Exception(String). Constructor for class java.lang.Exception Constructs an Exception with the specified detail message. exceptionEvent(RemoteThread, String). Method in interface sun.tools.debug.DebuggerCallback An exception has occurred. ExceptionInInitializerError(). Constructor for class java.lang.ExceptionInInitializerError Constructs an ExceptionInInitializerError with no detail message. ExceptionInInitializerError(String). Constructor for class java.lang.ExceptionInInitializerError Constructs a ExceptionInInitializerError with the specified detail message. ExceptionInInitializerError(Throwable). Constructor for class java.lang.ExceptionInInitializerError Constructs a new ExceptionInInitializerError class initialized to the specific throwable exec(String). Method in class java.lang.Runtime Executes the specified string command in a separate process. exec(String, String[]). Method in class java.lang.Runtime Executes the specified string command in a separate process with the specified environment. exec(String[]). Method in class java.lang.Runtime Executes the specified command and arguments in a separate process. exec(String[], String[]). Method in class java.lang.Runtime Executes the specified command and arguments in a separate process with the specified environment. execute(). Method in interface java.sql.PreparedStatement Some prepared statements return multiple results; the execute method handles these complex statements as well as the simpler form of statements handled by executeQuery and executeUpdate. execute(String). Method in interface java.sql.Statement Execute a SQL statement that may return multiple results.

ww w. ja

va
320

dil

i.c o

m

321
executeCall(). Method in interface java.rmi.server.RemoteCall Do whatever it takes to execute the call. executeQuery(). Method in interface java.sql.PreparedStatement A prepared SQL query is executed and its ResultSet is returned. executeQuery(String). Method in interface java.sql.Statement Execute a SQL statement that returns a single ResultSet. executeUpdate(). Method in interface java.sql.PreparedStatement Execute a SQL INSERT, UPDATE or DELETE statement. executeUpdate(String). Method in interface java.sql.Statement Execute a SQL INSERT, UPDATE or DELETE statement. exists(). Method in class java.io.File Tests if this File exists. exit(int). Method in class java.lang.Runtime Terminates the currently running Java Virtual Machine. exit(int). Static method in class java.lang.System Terminates the currently running Java Virtual Machine. exitValue(). Method in class java.lang.Process Returns the exit value for the subprocess. exp(double). Static method in class java.lang.Math Returns the exponential number e (i.e., 2.718...) raised to the power of a double value. ExportException(String). Constructor for class java.rmi.server.ExportException Create A remote exception with the specified string ExportException(String, Exception). Constructor for class java.rmi.server.ExportException Create A remote exception with the specified string, and the exception specified. exportObject(Remote). Static method in class java.rmi.server.UnicastRemoteObject Export the remote object to make it available to receive incoming calls. exportObject(Remote, Object). Method in interface java.rmi.server.ServerRef Find or create a client stub object for the supplied Remote.

F

ww w. ja

F1. Static variable in class java.awt.Event The F1 function action-key. F10. Static variable in class java.awt.Event The F10 function action-key. F11. Static variable in class java.awt.Event The F11 function action-key. F12. Static variable in class java.awt.Event The F12 function action-key. F2. Static variable in class java.awt.Event The F2 function action-key. F3. Static variable in class java.awt.Event The F3 function action-key. F4. Static variable in class java.awt.Event The F4 function action-key. F5. Static variable in class java.awt.Event The F5 function action-key. F6. Static variable in class java.awt.Event The F6 function action-key. F7. Static variable in class java.awt.Event The F7 function action-key. F8. Static variable in class java.awt.Event The F8 function action-key. F9. Static variable in class java.awt.Event The F9 function action-key. failure(Exception). Method in interface java.rmi.server.RMIFailureHandler The "failure" callback is invoked when the RMI runtime is unable to create a Socket or ServerSocket via the RMISocketFactory. FALSE. Static variable in class java.lang.Boolean The Boolean object corresponding to the primitive value false. fd. Variable in class java.net.DatagramSocketImpl The file descriptor object fd. Variable in class java.net.SocketImpl The file descriptor object for this socket. FeatureDescriptor(). Constructor for class java.beans.FeatureDescriptor FEBRUARY. Static variable in class java.util.Calendar Useful constant for month. FIELD_COUNT. Static variable in class java.util.Calendar Useful constant for date and time. FieldPosition(int). Constructor for class java.text.FieldPosition Creates a FieldPosition object for the given field. fields. Variable in class java.util.Calendar The time fields containing values into which the millis is computed. File(File, String). Constructor for class java.io.File

va
321

dil

i.c o

m

322
Creates a File instance that represents the file with the specified name in the specified directory. File(String). Constructor for class java.io.File Creates a File instance that represents the file whose pathname is the given path argument. File(String, String). Constructor for class java.io.File Creates a File instance whose pathname is the pathname of the specified directory, followed by the separator character, followed by the name argument. FileDescriptor(). Constructor for class java.io.FileDescriptor FileDialog(Frame). Constructor for class java.awt.FileDialog Creates a file dialog for loading a file. FileDialog(Frame, String). Constructor for class java.awt.FileDialog Creates a file dialog for loading a file. FileDialog(Frame, String, int). Constructor for class java.awt.FileDialog Creates a file dialog with the specified title and mode. FileInputStream(File). Constructor for class java.io.FileInputStream Creates an input file stream to read from the specified File object. FileInputStream(FileDescriptor). Constructor for class java.io.FileInputStream Creates an input file stream to read from the specified file descriptor. FileInputStream(String). Constructor for class java.io.FileInputStream Creates an input file stream to read from a file with the specified name. fileNameMap. Static variable in class java.net.URLConnection FileNotFoundException(). Constructor for class java.io.FileNotFoundException Constructs a FileNotFoundException with no detail message. FileNotFoundException(String). Constructor for class java.io.FileNotFoundException Constructs a FileNotFoundException with the specified detail message. FileOutputStream(File). Constructor for class java.io.FileOutputStream Creates a file output stream to write to the specified File object. FileOutputStream(FileDescriptor). Constructor for class java.io.FileOutputStream Creates an output file stream to write to the specified file descriptor. FileOutputStream(String). Constructor for class java.io.FileOutputStream Creates an output file stream to write to the file with the specified name. FileOutputStream(String, boolean). Constructor for class java.io.FileOutputStream Creates an output file with the specified system dependent file name. FileReader(File). Constructor for class java.io.FileReader FileReader(FileDescriptor). Constructor for class java.io.FileReader FileReader(String). Constructor for class java.io.FileReader FileWriter(File). Constructor for class java.io.FileWriter FileWriter(FileDescriptor). Constructor for class java.io.FileWriter FileWriter(String). Constructor for class java.io.FileWriter FileWriter(String, boolean). Constructor for class java.io.FileWriter fill. Variable in class java.awt.GridBagConstraints fill(). Method in class java.util.zip.InflaterInputStream Fills input buffer with more data to decompress. fill3DRect(int, int, int, int, boolean). Method in class java.awt.Graphics Paints a 3-D highlighted rectangle filled with the current color. fillArc(int, int, int, int, int, int). Method in class java.awt.Graphics Fills an arc bounded by the specified rectangle, starting at startAngle and extending for arcAngle degrees, with the current color. fillInStackTrace(). Method in class java.lang.Throwable Fills in the execution stack trace. fillOval(int, int, int, int). Method in class java.awt.Graphics Fills an oval bounded by the specified rectangle with the current color. fillPolygon(int[], int[], int). Method in class java.awt.Graphics Fills a polygon defined by arrays of x coordinates and y coordinates with the current color using an even-odd fill rule (otherwise known as an alternating rule). fillPolygon(Polygon). Method in class java.awt.Graphics Fills the polygon defined by the specified Polygon object with the current color using an even-odd fill rule (otherwise known as an alternating rule). fillRect(int, int, int, int). Method in class java.awt.Graphics Fills the specified rectangle with the current color. fillRoundRect(int, int, int, int, int, int). Method in class java.awt.Graphics Fills the specified rounded corner rectangle with the current color. FILTERED. Static variable in class java.util.zip.Deflater Compression strategy best used for data consisting mostly of small values with a somewhat random distribution. FilteredImageSource(ImageProducer, ImageFilter). Constructor for class java.awt.image.FilteredImageSource Constructs an ImageProducer object from an existing ImageProducer and a filter object. filterIndexColorModel(IndexColorModel). Method in class java.awt.image.RGBImageFilter Filters an IndexColorModel object by running each entry in its color tables through the filterRGB function that RGBImageFilter subclasses must provide. FilterInputStream(InputStream). Constructor for class java.io.FilterInputStream Creates an input stream filter built on top of the specified input stream. FilterOutputStream(OutputStream). Constructor for class java.io.FilterOutputStream Creates an output stream filter built on top of the specified underlying output stream. FilterReader(Reader). Constructor for class java.io.FilterReader Create a new filtered reader. filterRGB(int, int, int). Method in class java.awt.image.RGBImageFilter Subclasses must specify a method to convert a single input pixel in the default RGB ColorModel to a single output pixel.

ww w. ja

va
322

dil

i.c o

m

323
filterRGBPixels(int, int, int, int, int[], int, int). Method in class java.awt.image.RGBImageFilter Filters a buffer of pixels in the default RGB ColorModel by passing them one by one through the filterRGB method. FilterWriter(Writer). Constructor for class java.io.FilterWriter Create a new filtered writer. FINAL. Static variable in class java.lang.reflect.Modifier finalize(). Method in class java.awt.image.ColorModel Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. finalize(). Method in class java.util.zip.Deflater Frees the compressor when garbage is collected. finalize(). Method in class java.io.FileInputStream Ensures that the close method of this file input stream is called when there are no more references to it. finalize(). Method in class java.io.FileOutputStream Ensures that the close method of this file output stream is called when there are no more references to this stream. finalize(). Method in class java.awt.Graphics Disposes of this graphics context once it is no longer referenced. finalize(). Method in class java.util.zip.Inflater Frees the decompressor when garbage is collected. finalize(). Method in class java.lang.Object Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. finalize(). Method in class java.awt.PrintJob Ends this print job once it is no longer referenced. finalize(). Method in class sun.tools.debug.RemoteObject findClass(String). Method in class sun.tools.debug.RemoteDebugger Find a specified class. findColumn(String). Method in interface java.sql.ResultSet Map a Resultset column name to a ResultSet column index. findEditor(Class). Static method in class java.beans.PropertyEditorManager Locate a value editor for a given target type. findLoadedClass(String). Method in class java.lang.ClassLoader findSystemClass(String). Method in class java.lang.ClassLoader Finds the system class with the specified name, loading it in if necessary. finish(). Method in class java.util.zip.Deflater When called, indicates that compression should end with the current contents of the input buffer. finish(). Method in class java.util.zip.DeflaterOutputStream Finishes writing compressed data to the output stream without closing the underlying stream. finish(). Method in class java.util.zip.GZIPOutputStream Finishes writing compressed data to the output stream without closing the underlying stream. finish(). Method in class java.util.zip.ZipOutputStream Finishes writing the contents of the ZIP output stream without closing the underlying stream. finished(). Method in class java.util.zip.Deflater Returns true if the end of the compressed data output stream has been reached. finished(). Method in class java.util.zip.Inflater Return true if the end of the compressed data stream has been reached. firePropertyChange(). Method in class java.beans.PropertyEditorSupport Report that we have been modified to any interested listeners. firePropertyChange(String, Object, Object). Method in class java.beans.PropertyChangeSupport Report a bound property update to any registered listeners. fireVetoableChange(String, Object, Object). Method in class java.beans.VetoableChangeSupport Report a vetoable property update to any registered listeners. first(). Method in class java.text.BreakIterator Return the first boundary. first(). Method in interface java.text.CharacterIterator Set the position to getBeginIndex() and return the character at that position. first(). Method in class java.text.StringCharacterIterator Set the position to getBeginIndex() and return the character at that position. first(Container). Method in class java.awt.CardLayout Flip to the first card. firstElement(). Method in class java.util.Vector Returns the first component of this vector. flipBit(int). Method in class java.math.BigInteger Returns a BigInteger whose value is equivalent to this number with the designated bit flipped. FLOAT. Static variable in class java.sql.Types Float(double). Constructor for class java.lang.Float Constructs a newly allocated Floatobject that represents the argument converted to type float. Float(float). Constructor for class java.lang.Float Constructs a newly allocated Float object that represents the primitive float argument. Float(String). Constructor for class java.lang.Float Constructs a newly allocated Float object that represents the floating- point value of type float represented by the string. floatToIntBits(float). Static method in class java.lang.Float Returns the bit represention of a single-float value. floatValue(). Method in class java.math.BigDecimal Converts this number to a float. floatValue(). Method in class java.math.BigInteger Converts this number to a float.

ww w. ja

va
323

dil

i.c o

m

324
floatValue(). Method in class java.lang.Byte Returns the value of this Byte as a float. floatValue(). Method in class java.lang.Double Returns the float value of this Double. floatValue(). Method in class java.lang.Float Returns the float value of this Float object. floatValue(). Method in class java.lang.Integer Returns the value of this Integer as a float. floatValue(). Method in class java.lang.Long Returns the value of this Long as a float. floatValue(). Method in class java.lang.Number Returns the value of the specified number as a float. floatValue(). Method in class java.lang.Short Returns the value of this Short as a float. floor(double). Static method in class java.lang.Math Returns the largest (closest to positive infinity) double value that is not greater than the argument and is equal to a mathematical integer. FlowLayout(). Constructor for class java.awt.FlowLayout Constructs a new Flow Layout with a centered alignment and a default 5-unit horizontal and vertical gap. FlowLayout(int). Constructor for class java.awt.FlowLayout Constructs a new Flow Layout with the specified alignment and a default 5-unit horizontal and vertical gap. FlowLayout(int, int, int). Constructor for class java.awt.FlowLayout Constructs a new Flow Layout with the specified alignment and gap values. flush(). Method in class java.io.BufferedOutputStream Flushes this buffered output stream. flush(). Method in class java.io.BufferedWriter Flush the stream. flush(). Method in class java.io.CharArrayWriter Flush the stream. flush(). Method in class java.io.DataOutputStream Flushes this data output stream. flush(). Method in class java.io.FilterOutputStream Flushes this output stream and forces any buffered output bytes to be written out to the stream. flush(). Method in class java.io.FilterWriter Flush the stream. flush(). Method in class java.awt.Image Flushes all resources being used by this Image object. flush(). Method in interface java.io.ObjectOutput Flushes the stream. flush(). Method in class java.io.ObjectOutputStream Flushes the stream. flush(). Method in class java.io.OutputStream Flushes this output stream and forces any buffered output bytes to be written out. flush(). Method in class java.io.OutputStreamWriter Flush the stream. flush(). Method in class java.io.PipedOutputStream Flushes this output stream and forces any buffered output bytes to be written out. flush(). Method in class java.io.PipedWriter Flush the stream. flush(). Method in class java.io.PrintStream Flushes this print stream. flush(). Method in class java.io.PrintWriter Flush the stream. flush(). Method in class java.io.StringWriter Flush the stream. flush(). Method in class java.io.Writer Flush the stream. FOCUS_EVENT_MASK. Static variable in class java.awt.AWTEvent The event mask for selecting focus events. FOCUS_FIRST. Static variable in class java.awt.event.FocusEvent Marks the first integer id for the range of focus event ids. FOCUS_GAINED. Static variable in class java.awt.event.FocusEvent The focus gained event type. FOCUS_LAST. Static variable in class java.awt.event.FocusEvent Marks the last integer id for the range of focus event ids. FOCUS_LOST. Static variable in class java.awt.event.FocusEvent The focus lost event type. FocusAdapter(). Constructor for class java.awt.event.FocusAdapter FocusEvent(Component, int). Constructor for class java.awt.event.FocusEvent Constructs a permanent-level FocusEvent object with the specified source component and type. FocusEvent(Component, int, boolean). Constructor for class java.awt.event.FocusEvent Constructs a FocusEvent object with the specified source component, type, and whether or not the focus event is a temporary level event. focusGained(FocusEvent). Method in class java.awt.AWTEventMulticaster Handles the focusGained event by invoking the focusGained methods on listener-a and listener-b. focusGained(FocusEvent). Method in class java.awt.event.FocusAdapter

ww w. ja

va
324

dil

i.c o

m

325
focusGained(FocusEvent). Method in interface java.awt.event.FocusListener Invoked when a component gains the keyboard focus. focusLost(FocusEvent). Method in class java.awt.AWTEventMulticaster Handles the focusLost event by invoking the focusLost methods on listener-a and listener-b. focusLost(FocusEvent). Method in class java.awt.event.FocusAdapter focusLost(FocusEvent). Method in interface java.awt.event.FocusListener Invoked when a component loses the keyboard focus. following(int). Method in class java.text.BreakIterator Return the first boundary following the specified offset. font. Variable in class java.awt.FontMetrics The actual font. Font(String, int, int). Constructor for class java.awt.Font Creates a new font with the specified name, style and point size. FontMetrics(Font). Constructor for class java.awt.FontMetrics Creates a new FontMetrics object with the specified font. forClass(). Method in class java.io.ObjectStreamClass Return the class in the local VM that this version is mapped to. forDigit(int, int). Static method in class java.lang.Character Determines the character representation for a specific digit in the specified radix. FORMAT. Static variable in class java.lang.Character Format(). Constructor for class java.text.Format format(Date). Method in class java.text.DateFormat Formats a Date into a date/time string. format(Date, StringBuffer, FieldPosition). Method in class java.text.DateFormat Formats a Date into a date/time string. format(Date, StringBuffer, FieldPosition). Method in class java.text.SimpleDateFormat Overrides DateFormat

ww w. ja

Formats a date or time, which is the standard millis since 24:00 GMT, Jan 1, 1970. format(double). Method in class java.text.NumberFormat Specialization of format. format(double, StringBuffer, FieldPosition). Method in class java.text.ChoiceFormat Specialization of format. format(double, StringBuffer, FieldPosition). Method in class java.text.DecimalFormat Specialization of format. format(double, StringBuffer, FieldPosition). Method in class java.text.NumberFormat Specialization of format. format(long). Method in class java.text.NumberFormat Specialization of format. format(long, StringBuffer, FieldPosition). Method in class java.text.ChoiceFormat Specialization of format. format(long, StringBuffer, FieldPosition). Method in class java.text.DecimalFormat Specialization of format. format(long, StringBuffer, FieldPosition). Method in class java.text.NumberFormat Specialization of format. format(Object). Method in class java.text.Format Formats an object to produce a string. format(Object, StringBuffer, FieldPosition). Method in class java.text.DateFormat Overrides Format. format(Object, StringBuffer, FieldPosition). Method in class java.text.Format Formats an object to produce a string. format(Object, StringBuffer, FieldPosition). Method in class java.text.MessageFormat Formats an object to produce a string. format(Object, StringBuffer, FieldPosition). Method in class java.text.NumberFormat Formats an object to produce a string. format(Object[], StringBuffer, FieldPosition). Method in class java.text.MessageFormat Returns pattern with formatted objects. format(String, Object[]). Static method in class java.text.MessageFormat Convenience routine. FormatException(String, int). Constructor for class java.text.FormatException Constructs a FormatException with the specified detail message and offset. forName(String). Static method in class java.lang.Class Returns the Class object associated with the class with the given string name. FRACTION_FIELD. Static variable in class java.text.NumberFormat Field constant used to construct a FieldPosition object. Frame(). Constructor for class java.awt.Frame Constructs a new Frame that is initially invisible. Frame(String). Constructor for class java.awt.Frame Constructs a new, initially invisible Frame with the specified title. FRAMEBITS. Static variable in interface java.awt.image.ImageObserver Another complete frame of a multi-frame image which was previously drawn is now available to be drawn again. FRANCE. Static variable in class java.util.Locale Useful constant for country. freeMemory(). Method in class sun.tools.debug.RemoteDebugger Report the free memory available to the Java interpreter being debugged. freeMemory(). Method in class java.lang.Runtime

va
325

dil

i.c o

m

326
Returns the amount of free memory in the system. FRENCH. Static variable in class java.util.Locale Useful constant for language. FRIDAY. Static variable in class java.util.Calendar Useful constant for days of week. fromHex(String). Static method in class sun.tools.debug.RemoteValue Convert hexadecimal strings to ints. FULL. Static variable in class java.text.DateFormat Constant for full style pattern. FULL_DECOMPOSITION. Static variable in class java.text.Collator Decomposition mode value.

G

ww w. ja

gc(). Method in class java.lang.Runtime Runs the garbage collector. gc(). Static method in class java.lang.System Runs the garbage collector. gc(RemoteObject[]). Method in class sun.tools.debug.RemoteDebugger Free all objects referenced by the debugger. gcd(BigInteger). Method in class java.math.BigInteger Returns a BigInteger whose value is the greatest common denominator of abs(this) and abs(val). generateKeyPair(). Method in class java.security.KeyPairGenerator Generates a key pair. GERMAN. Static variable in class java.util.Locale Useful constant for language. GERMANY. Static variable in class java.util.Locale Useful constant for country. get(). Method in class sun.tools.debug.RemoteBoolean Return the boolean's value. get(). Method in class sun.tools.debug.RemoteByte Return the byte's value. get(). Method in class sun.tools.debug.RemoteChar Return the char's value. get(). Method in class sun.tools.debug.RemoteDouble Return the double's value. get(). Method in class sun.tools.debug.RemoteFloat Return the float's value. get(). Method in class sun.tools.debug.RemoteInt Return the int's value. get(). Method in class sun.tools.debug.RemoteLong Return the long's value. get(). Method in class sun.tools.debug.RemoteShort Return the short's value. get(int). Method in class java.util.BitSet Returns the value of the bit with the specified index. get(int). Method in class java.util.Calendar Gets the value for a given time field. get(Integer). Method in class sun.tools.debug.RemoteDebugger Get an object from the remote object cache. get(Object). Method in class java.util.Dictionary Returns the value to which the key is mapped in this dictionary. get(Object). Method in class java.lang.reflect.Field Returns the value of the field represented by this Field, on the specified object. get(Object). Method in class java.util.Hashtable Returns the value to which the specified key is mapped in this hashtable. get(Object, int). Static method in class java.lang.reflect.Array Returns the value of the indexed component in the specified array object. getAbsolutePath(). Method in class java.io.File Returns the absolute pathname of the file represented by this object. getActionCommand(). Method in class java.awt.event.ActionEvent Returns the command name associated with this action. getActionCommand(). Method in class java.awt.Button Returns the command name of the action event fired by this button. getActionCommand(). Method in class java.awt.MenuItem Returns the command name of the action event fired by this menu item. getAdditionalBeanInfo(). Method in interface java.beans.BeanInfo This method allows a BeanInfo object to return an arbitrary collection of other BeanInfo objects that provide additional information on the current bean. getAdditionalBeanInfo(). Method in class java.beans.SimpleBeanInfo Claim there are no other relevant BeanInfo objects. getAddListenerMethod(). Method in class java.beans.EventSetDescriptor getAddress(). Method in class java.net.DatagramPacket Returns the IP address of the machine to which this datagram is being sent or from which the datagram was received.

va
326

dil

i.c o

m

327
getAddress(). Method in class java.net.InetAddress Returns the raw IP address of this InetAddress object. getAdjustable(). Method in class java.awt.event.AdjustmentEvent Returns the Adjustable object where this event originated. getAdjustmentType(). Method in class java.awt.event.AdjustmentEvent Returns the type of adjustment which caused the value changed event. getAdler(). Method in class java.util.zip.Deflater Returns the ADLER-32 value of the uncompressed data. getAdler(). Method in class java.util.zip.Inflater Returns the ADLER-32 value of the uncompressed data. getAlgorithm(). Method in interface java.security.Key Returns the standard algorithm name this key is for. getAlgorithm(). Method in class java.security.KeyPairGenerator Returns the standard name of the algorithm for this key generator. getAlgorithm(). Method in class java.security.MessageDigest Returns a string that identifies the algorithm, independent of implementation details. getAlgorithm(). Method in class java.security.Signature Returns the name of the algorithm for this signature object. getAlgorithmProperty(String, String). Static method in class java.security.Security Gets a specified property for an algorithm. getAlignment(). Method in class java.awt.FlowLayout Returns the alignment value for this layout, one of LEFT, CENTER, or RIGHT. getAlignment(). Method in class java.awt.Label Gets the current alignment of this label. getAlignmentX(). Method in class java.awt.Component Returns the alignment along the x axis. getAlignmentX(). Method in class java.awt.Container Returns the alignment along the x axis. getAlignmentY(). Method in class java.awt.Component Returns the alignment along the y axis. getAlignmentY(). Method in class java.awt.Container Returns the alignment along the y axis. getAllByName(String). Static method in class java.net.InetAddress Determines all the IP addresses of a host, given the host's name. getAllowUserInteraction(). Method in class java.net.URLConnection Returns the value of the allowUserInteraction field for this object. getAlpha(int). Method in class java.awt.image.ColorModel The subclass must provide a function which provides the alpha color compoment for the specified pixel. getAlpha(int). Method in class java.awt.image.DirectColorModel Return the alpha transparency value for the specified pixel in the range 0-255. getAlpha(int). Method in class java.awt.image.IndexColorModel Returns the alpha transparency value for the specified pixel in the range 0-255. getAlphaMask(). Method in class java.awt.image.DirectColorModel Returns the mask indicating which bits in a pixel contain the alpha transparency component. getAlphas(byte[]). Method in class java.awt.image.IndexColorModel Copies the array of alpha transparency values into the given array. getAmPmStrings(). Method in class java.text.DateFormatSymbols Gets ampm strings. getApplet(String). Method in interface java.applet.AppletContext Finds and returns the applet in the document represented by this applet context with the given name. getAppletContext(). Method in class java.applet.Applet Determines this applet's context, which allows the applet to query and affect the environment in which it runs. getAppletContext(). Method in interface java.applet.AppletStub Gets a handler to the applet's context. getAppletInfo(). Method in class java.applet.Applet Returns information about this applet. getApplets(). Method in interface java.applet.AppletContext Finds all the applets in the document represented by this applet context. getAscent(). Method in class java.awt.FontMetrics Gets the font ascent. getAsciiStream(int). Method in interface java.sql.ResultSet A column value can be retrieved as a stream of ASCII characters and then read in chunks from the stream. getAsciiStream(String). Method in interface java.sql.ResultSet A column value can be retrieved as a stream of ASCII characters and then read in chunks from the stream. getAsText(). Method in interface java.beans.PropertyEditor getAsText(). Method in class java.beans.PropertyEditorSupport getAudioClip(URL). Method in class java.applet.Applet Returns the AudioClip object specified by the URL argument. getAudioClip(URL). Method in interface java.applet.AppletContext Creates an audio clip. getAudioClip(URL, String). Method in class java.applet.Applet Returns the AudioClip object specified by the URL and name arguments. getAutoCommit(). Method in interface java.sql.Connection Get the current auto-commit state. getAvailableIDs(). Static method in class java.util.TimeZone Gets all the available IDs supported.

ww w. ja

va
327

dil

i.c o

m

328
getAvailableIDs(int). Static method in class java.util.TimeZone Gets the available IDs according to the given time zone offset. getAvailableLocales(). Static method in class java.text.BreakIterator Get the set of Locales for which TextBoundaries are installed getAvailableLocales(). Static method in class java.util.Calendar Gets the set of locales for which Calendars are installed. getAvailableLocales(). Static method in class java.text.Collator Get the set of Locales for which Collators are installed. getAvailableLocales(). Static method in class java.text.DateFormat Gets the set of locales for which DateFormats are installed. getAvailableLocales(). Static method in class java.text.NumberFormat Get the set of Locales for which NumberFormats are installed getBackground(). Method in class java.awt.Component Gets the background color. getBeanClass(). Method in class java.beans.BeanDescriptor getBeanDescriptor(). Method in interface java.beans.BeanInfo getBeanDescriptor(). Method in class java.beans.SimpleBeanInfo Deny knowledge about the class and customizer of the bean. getBeanInfo(Class). Static method in class java.beans.Introspector Introspect on a Java bean and learn about all its properties, exposed methods, and events. getBeanInfo(Class, Class). Static method in class java.beans.Introspector Introspect on a Java bean and learn all about its properties, exposed methods, below a given "stop" point. getBeanInfoSearchPath(). Static method in class java.beans.Introspector getBeginIndex(). Method in interface java.text.CharacterIterator Return the start index of the text. getBeginIndex(). Method in class java.text.FieldPosition Retrieve the index of the first character in the requested field. getBeginIndex(). Method in class java.text.StringCharacterIterator Return the start index of the text. getBestRowIdentifier(String, String, String, int, boolean). Method in interface java.sql.DatabaseMetaData Get a description of a table's optimal set of columns that uniquely identifies a row. getBigDecimal(int, int). Method in interface java.sql.CallableStatement Get the value of a NUMERIC parameter as a java.math.BigDecimal object. getBigDecimal(int, int). Method in interface java.sql.ResultSet Get the value of a column in the current row as a java.lang.BigDecimal object. getBigDecimal(String, int). Method in interface java.sql.ResultSet Get the value of a column in the current row as a java.lang.BigDecimal object. getBinaryStream(int). Method in interface java.sql.ResultSet A column value can be retrieved as a stream of uninterpreted bytes and then read in chunks from the stream. getBinaryStream(String). Method in interface java.sql.ResultSet A column value can be retrieved as a stream of uninterpreted bytes and then read in chunks from the stream. getBlockIncrement(). Method in interface java.awt.Adjustable Gets the block value increment for the adjustable object. getBlockIncrement(). Method in class java.awt.Scrollbar Gets the block increment for this scrollbar. getBlue(). Method in class java.awt.Color Gets the blue component. getBlue(int). Method in class java.awt.image.ColorModel The subclass must provide a function which provides the blue color compoment for the specified pixel. getBlue(int). Method in class java.awt.image.DirectColorModel Returns the blue color compoment for the specified pixel in the range 0-255. getBlue(int). Method in class java.awt.image.IndexColorModel Returns the blue color compoment for the specified pixel in the range 0-255. getBlueMask(). Method in class java.awt.image.DirectColorModel Returns the mask indicating which bits in a pixel contain the blue color component. getBlues(byte[]). Method in class java.awt.image.IndexColorModel Copies the array of blue color components into the given array. getBoolean(int). Method in interface java.sql.CallableStatement Get the value of a BIT parameter as a Java boolean. getBoolean(int). Method in interface java.sql.ResultSet Get the value of a column in the current row as a Java boolean. getBoolean(Object). Method in class java.lang.reflect.Field Get the value of a field as a boolean on specified object. getBoolean(Object, int). Static method in class java.lang.reflect.Array Returns the value of the indexed component in the specified array object, as a boolean. getBoolean(String). Static method in class java.lang.Boolean Returns is true if and only if the system property named by the argument exists and is equal to the string "true". getBoolean(String). Method in interface java.sql.ResultSet Get the value of a column in the current row as a Java boolean. getBoundingBox(). Method in class java.awt.Polygon getBounds(). Method in class java.awt.Component Returns the current bounds of this component. getBounds(). Method in class java.awt.Polygon Returns the bounding box of the shape. getBounds(). Method in class java.awt.Rectangle Returns the bounds of this rectangle.

ww w. ja

va
328

dil

i.c o

m

329
getBounds(). Method in interface java.awt.Shape Return the bounding box of the shape. getBuffer(). Method in class java.io.StringWriter Return the string buffer itself. getBundle(String). Static method in class java.util.ResourceBundle Get the appropriate ResourceBundle subclass. getBundle(String, Locale). Static method in class java.util.ResourceBundle Get the appropriate ResourceBundle subclass. getByName(String). Static method in class java.net.InetAddress Determines the IP address of a host, given the host's name. getByte(int). Method in interface java.sql.CallableStatement Get the value of a TINYINT parameter as a Java byte. getByte(int). Method in interface java.sql.ResultSet Get the value of a column in the current row as a Java byte. getByte(Object). Method in class java.lang.reflect.Field Get the value of a field as a byte on specified object. getByte(Object, int). Static method in class java.lang.reflect.Array Returns the value of the indexed component in the specified array object, as a byte. getByte(String). Method in interface java.sql.ResultSet Get the value of a column in the current row as a Java byte. getBytes(). Method in class java.lang.String Convert this String into bytes according to the platform's default character encoding, storing the result into a new byte array. getBytes(int). Method in interface java.sql.CallableStatement Get the value of a SQL BINARY or VARBINARY parameter as a Java byte[] getBytes(int). Method in interface java.sql.ResultSet Get the value of a column in the current row as a Java byte array. getBytes(int, int, byte[], int). Method in class java.lang.String Copies characters from this string into the destination byte array. getBytes(String). Method in interface java.sql.ResultSet Get the value of a column in the current row as a Java byte array. getBytes(String). Method in class java.lang.String Convert this String into bytes according to the specified character encoding, storing the result into a new byte array. getCalendar(). Method in class java.text.DateFormat Gets the calendar associated with this date/time formatter. getCanonicalPath(). Method in class java.io.File Gets the official, canonical path of the File. getCaretPosition(). Method in class java.awt.TextComponent Returns the position of the text insertion caret for the text component. getCaretPosition(). Method in interface java.awt.peer.TextComponentPeer getCatalog(). Method in interface java.sql.Connection Return the Connection's current catalog name. getCatalogName(int). Method in interface java.sql.ResultSetMetaData What's a column's table's catalog name? getCatalogs(). Method in interface java.sql.DatabaseMetaData Get the catalog names available in this database. getCatalogSeparator(). Method in interface java.sql.DatabaseMetaData What's the separator between catalog and table name? getCatalogTerm(). Method in interface java.sql.DatabaseMetaData What's the database vendor's preferred term for "catalog"? getChar(Object). Method in class java.lang.reflect.Field Get the value of a field as a char on specified object. getChar(Object, int). Static method in class java.lang.reflect.Array Returns the value of the indexed component in the specified array object, as a char. getCharacterInstance(). Static method in class java.text.BreakIterator Create BreakIterator for character-breaks using default locale Returns an instance of a BreakIterator implementing character breaks. getCharacterInstance(Locale). Static method in class java.text.BreakIterator Create BreakIterator for character-breaks using specified locale Returns an instance of a BreakIterator implementing character breaks. getChars(int, int, char[], int). Method in class java.lang.String Copies characters from this string into the destination character array. getChars(int, int, char[], int). Method in class java.lang.StringBuffer Characters are copied from this string buffer into the destination character array dst. getCheckboxGroup(). Method in class java.awt.Checkbox Returns the checkbox group. getChecksum(). Method in class java.util.zip.CheckedInputStream Returns the Checksum for this input stream. getChecksum(). Method in class java.util.zip.CheckedOutputStream Returns the Checksum for this output stream. getChild(). Method in class java.awt.event.ContainerEvent Returns the child component that was added or removed in this event. getClass(). Method in class java.lang.Object Returns the runtime class of an object. getClassContext(). Method in class java.lang.SecurityManager Returns the current execution stack as an array of classes. getClasses(). Method in class java.lang.Class

ww w. ja

va
329

dil

i.c o

m

330
Returns an array containing Class objects representing all the public classes and interfaces that are members of the class represented by this Class object. getClassLoader(). Method in class java.lang.Class Determines the class loader for the class. getClassLoader(). Method in class sun.tools.debug.RemoteClass Return the classloader for this class. getClassName(). Method in class java.util.MissingResourceException Gets parameter passed by constructor. getClazz(). Method in class sun.tools.debug.RemoteObject Returns the object's class. getClickCount(). Method in class java.awt.event.MouseEvent Return the number of mouse clicks associated with this event. getClientHost(). Static method in class java.rmi.server.RemoteServer Return the hostname of the current client. getClientHost(). Method in interface java.rmi.server.ServerRef Return the hostname of the current client. getClip(). Method in class java.awt.Graphics Return a Shape object representing the current clipping area. getClipBounds(). Method in class java.awt.Graphics Returns the bounding rectangle of the current clipping area. getClipRect(). Method in class java.awt.Graphics getCodeBase(). Method in class java.applet.Applet Gets the base URL. getCodeBase(). Method in interface java.applet.AppletStub Gets the base URL. getCollationElementIterator(String). Method in class java.text.RuleBasedCollator Return a CollationElementIterator for the given String. getCollationKey(String). Method in class java.text.Collator Transforms the String into a series of bits that can be compared bitwise to other CollationKeys. getCollationKey(String). Method in class java.text.RuleBasedCollator Transforms the string into a series of characters that can be compared with CollationKey.compareTo. getColor(). Method in class java.awt.Graphics Gets the current color. getColor(String). Static method in class java.awt.Color Gets the specified Color property. getColor(String, Color). Static method in class java.awt.Color Gets the specified Color property of the specified Color. getColor(String, int). Static method in class java.awt.Color Gets the specified Color property of the color value. getColorModel(). Method in class java.awt.Component Gets the ColorModel used to display the component on the output device. getColorModel(). Method in interface java.awt.peer.ComponentPeer getColorModel(). Method in class java.awt.image.PixelGrabber Get the ColorModel for the pixels stored in the array. getColorModel(). Method in class java.awt.Toolkit Returns the ColorModel of the screen. getColumnCount(). Method in interface java.sql.ResultSetMetaData What's the number of columns in the ResultSet? getColumnDisplaySize(int). Method in interface java.sql.ResultSetMetaData What's the column's normal max width in chars? getColumnLabel(int). Method in interface java.sql.ResultSetMetaData What's the suggested column title for use in printouts and displays? getColumnName(int). Method in interface java.sql.ResultSetMetaData What's a column's name? getColumnPrivileges(String, String, String, String). Method in interface java.sql.DatabaseMetaData Get a description of the access rights for a table's columns. getColumns(). Method in class java.awt.GridLayout Returns the number of columns in this layout. getColumns(). Method in class java.awt.TextArea Returns the number of columns in the TextArea. getColumns(). Method in class java.awt.TextField Returns the number of columns in this TextField. getColumns(String, String, String, String). Method in interface java.sql.DatabaseMetaData Get a description of table columns available in a catalog. getColumnType(int). Method in interface java.sql.ResultSetMetaData What's a column's SQL type? getColumnTypeName(int). Method in interface java.sql.ResultSetMetaData What's a column's data source specific type name? getComment(). Method in class java.util.zip.ZipEntry Returns the comment string for the entry, or null if none. getComponent(). Method in class java.awt.event.ComponentEvent Returns the component where this event originated. getComponent(int). Method in class java.awt.Container Gets the nth component in this container. getComponentAt(int, int). Method in class java.awt.Component Returns the component or subcomponent that contains the x,y location.

ww w. ja

va
330

dil

i.c o

m

331
getComponentAt(int, int). Method in class java.awt.Container Locates the component that contains the x,y position. getComponentAt(Point). Method in class java.awt.Component Returns the component or subcomponent that contains the specified point. getComponentAt(Point). Method in class java.awt.Container Locates the component that contains the specified point. getComponentCount(). Method in class java.awt.Container Returns the number of components in this panel. getComponents(). Method in class java.awt.Container Gets all the components in this container. getComponentType(). Method in class java.lang.Class If this class represents an array type, returns the Class object representing the component type of the array; otherwise returns null. getCompressedSize(). Method in class java.util.zip.ZipEntry Returns the compressed size of the entry data, or -1 if not known. getConnection(String). Static method in class java.sql.DriverManager Attempt to establish a connection to the given database URL. getConnection(String, Properties). Static method in class java.sql.DriverManager Attempt to establish a connection to the given database URL. getConnection(String, String, String). Static method in class java.sql.DriverManager Attempt to establish a connection to the given database URL. getConstraints(Component). Method in class java.awt.GridBagLayout Retrieves the constraints for the specified component. getConstructor(Class[]). Method in class java.lang.Class Returns a Constructor object that reflects the specified public constructor of the class represented by this Class object. getConstructors(). Method in class java.lang.Class Returns an array containing Constructor objects reflecting all the public constructors of the class represented by this Class object. getContainer(). Method in class java.awt.event.ContainerEvent Returns the container where this event originated. getContent(). Method in class java.net.URL Returns the contents of this URL. getContent(). Method in class java.net.URLConnection Retrieves the contents of this URL connection. getContent(URLConnection). Method in class java.net.ContentHandler Given a URL connect stream positioned at the beginning of the representation of an object, this method reads that stream and creates an object from it. getContentEncoding(). Method in class java.net.URLConnection Returns the value of the content-encoding header field. getContentLength(). Method in class java.net.URLConnection Returns the value of the content-length header field. getContents(). Method in class java.util.ListResourceBundle See class description. getContents(Object). Method in class java.awt.datatransfer.Clipboard Returns a transferable object representing the current contents of the clipboard. getContentType(). Method in class java.net.URLConnection Returns the value of the content-type header field. getContentTypeFor(String). Method in interface java.net.FileNameMap getCountry(). Method in class java.util.Locale Getter for programmatic name of field, an uppercased two-letter ISO-3166 code. getCrc(). Method in class java.util.zip.ZipEntry Returns the CRC-32 checksum of the uncompressed entry data, or -1 if not known. getCrossReference(String, String, String, String, String, String). Method in interface java.sql.DatabaseMetaData Get a description of the foreign key columns in the foreign key table that reference the primary key columns of the primary key table (describe how one table imports another's key.) This should normally return a single foreign key/primary key pair (most tables only import a foreign key from a table once.) They are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and KEY_SEQ. getCurrencyInstance(). Static method in class java.text.NumberFormat Returns a currency format for the current default locale. getCurrencyInstance(Locale). Static method in class java.text.NumberFormat Returns a currency format for the specified locale. getCurrent(). Method in class java.awt.CheckboxGroup getCurrentFrame(). Method in class sun.tools.debug.RemoteThread Get the current stack frame. getCurrentFrameIndex(). Method in class sun.tools.debug.RemoteThread Return the current stackframe index getCursor(). Method in class java.awt.Component Gets the cursor set on this component. getCursorName(). Method in interface java.sql.ResultSet Get the name of the SQL cursor used by this ResultSet. getCursorType(). Method in class java.awt.Frame getCustomEditor(). Method in interface java.beans.PropertyEditor A PropertyEditor may choose to make available a full custom Component that edits its property value. getCustomEditor(). Method in class java.beans.PropertyEditorSupport A PropertyEditor may chose to make available a full custom Component that edits its property value. getCustomizerClass(). Method in class java.beans.BeanDescriptor

ww w. ja

va
331

dil

i.c o

m

332
getData(). Method in class java.net.DatagramPacket Returns the data received or the data to be sent. getDatabaseProductName(). Method in interface java.sql.DatabaseMetaData What's the name of this database product? getDatabaseProductVersion(). Method in interface java.sql.DatabaseMetaData What's the version of this database product? getDataSize(). Method in class java.sql.DataTruncation Get the number of bytes of data that should have been transferred. getDate(). Method in class java.util.Date Returns the day of the month represented by this date. getDate(). Method in class java.sql.Time Returns the day of the month represented by this date. getDate(). Method in class java.net.URLConnection Returns the value of the date header field. getDate(int). Method in interface java.sql.CallableStatement Get the value of a SQL DATE parameter as a java.sql.Date object getDate(int). Method in interface java.sql.ResultSet Get the value of a column in the current row as a java.sql.Date object. getDate(String). Method in interface java.sql.ResultSet Get the value of a column in the current row as a java.sql.Date object. getDateFormatSymbols(). Method in class java.text.SimpleDateFormat Gets the date/time formatting data. getDateInstance(). Static method in class java.text.DateFormat Gets the date formatter with the default formatting style for the default locale. getDateInstance(int). Static method in class java.text.DateFormat Gets the date formatter with the given formatting style for the default locale. getDateInstance(int, Locale). Static method in class java.text.DateFormat Gets the date formatter with the given formatting style for the given locale. getDateTimeInstance(). Static method in class java.text.DateFormat Gets the date/time formatter with the default formatting style for the default locale. getDateTimeInstance(int, int). Static method in class java.text.DateFormat Gets the date/time formatter with the given date and time formatting styles for the default locale. getDateTimeInstance(int, int, Locale). Static method in class java.text.DateFormat Gets the date/time formatter with the given formatting styles for the given locale. getDay(). Method in class java.util.Date Returns the day of the week represented by this date. getDay(). Method in class java.sql.Time Returns the day of the week represented by this date. getDecimalFormatSymbols(). Method in class java.text.DecimalFormat Returns the decimal format symbols, which is generally not changed by the programmer or user. getDecimalSeparator(). Method in class java.text.DecimalFormatSymbols character used for decimal sign. getDeclaredClasses(). Method in class java.lang.Class Returns an array of Class objects reflecting all the classes and interfaces declared as members of the class represented by this Class object. getDeclaredConstructor(Class[]). Method in class java.lang.Class Returns a Constructor object that reflects the specified declared constructor of the class or interface represented by this Class object. getDeclaredConstructors(). Method in class java.lang.Class Returns an array of Constructor objects reflecting all the constructors declared by the class represented by this Class object. getDeclaredField(String). Method in class java.lang.Class Returns a Field object that reflects the specified declared field of the class or interface represented by this Class object. getDeclaredFields(). Method in class java.lang.Class Returns an array of Field objects reflecting all the fields declared by the class or interface represented by this Class object. getDeclaredMethod(String, Class[]). Method in class java.lang.Class Returns a Method object that reflects the specified declared method of the class or interface represented by this Class object. getDeclaredMethods(). Method in class java.lang.Class Returns an array of Method objects reflecting all the methods declared by the class or interface represented by this Class object. getDeclaringClass(). Method in class java.lang.Class If the class or interface represented by this Class object is a member of another class, returns the Class object representing the class of which it is a member (its declaring class). getDeclaringClass(). Method in class java.lang.reflect.Constructor Returns the Class object representing the class that declares the constructor represented by this Constructor object. getDeclaringClass(). Method in class java.lang.reflect.Field Returns the Class object representing the class or interface that declares the field represented by this Field object. getDeclaringClass(). Method in interface java.lang.reflect.Member Returns the Class object representing the class or interface that declares the member or constructor represented by this Member. getDeclaringClass(). Method in class java.lang.reflect.Method Returns the Class object representing the class or interface that declares the method represented by this Method object. getDecomposition(). Method in class java.text.Collator Get the decomposition mode of this Collator. getDefault(). Static method in class java.util.Locale Common method of getting the current default Locale. getDefault(). Static method in class java.util.TimeZone

ww w. ja

va
332

dil

i.c o

m

333
Gets the default TimeZone for this host. getDefaultAllowUserInteraction(). Static method in class java.net.URLConnection Returns the default value of the allowUserInteraction field. getDefaultCursor(). Static method in class java.awt.Cursor Return the system default cursor. getDefaultEventIndex(). Method in interface java.beans.BeanInfo A bean may have a "default" event that is the event that will mostly commonly be used by human's when using the bean. getDefaultEventIndex(). Method in class java.beans.SimpleBeanInfo Deny knowledge of a default event. getDefaultPropertyIndex(). Method in interface java.beans.BeanInfo A bean may have a "default" property that is the property that will mostly commonly be initially chosen for update by human's who are customizing the bean. getDefaultPropertyIndex(). Method in class java.beans.SimpleBeanInfo Deny knowledge of a default property. getDefaultRequestProperty(String). Static method in class java.net.URLConnection Returns the value of the default request property. getDefaultStream(). Static method in class java.rmi.server.LogStream Return the current default stream for new logs. getDefaultToolkit(). Static method in class java.awt.Toolkit Returns the default toolkit. getDefaultTransactionIsolation(). Method in interface java.sql.DatabaseMetaData What's the database's default transaction isolation level? The values are defined in java.sql.Connection. getDefaultUseCaches(). Method in class java.net.URLConnection Returns the default value of a URLConnection's useCaches flag. getDescent(). Method in class java.awt.FontMetrics Gets the font descent. getDigit(). Method in class java.text.DecimalFormatSymbols character used for a digit in a pattern. getDirectory(). Method in class java.awt.FileDialog Gets the directory of the Dialog. getDisplayCountry(). Method in class java.util.Locale Getter for display of field to user. getDisplayCountry(Locale). Method in class java.util.Locale Getter for display of field to user. getDisplayLanguage(). Method in class java.util.Locale Getter for display of field to user. getDisplayLanguage(Locale). Method in class java.util.Locale Getter for display of field to user. getDisplayName(). Method in class java.beans.FeatureDescriptor getDisplayName(). Method in class java.util.Locale Getter for display of the entire locale to user. getDisplayName(Locale). Method in class java.util.Locale Getter for display of the entire locale to user. getDisplayVariant(). Method in class java.util.Locale Getter for display of field to user. getDisplayVariant(Locale). Method in class java.util.Locale Getter for display of field to user If the localized name is not found, returns the variant code. getDocumentBase(). Method in class java.applet.Applet Gets the document URL. getDocumentBase(). Method in interface java.applet.AppletStub Gets the document URL. getDoInput(). Method in class java.net.URLConnection Returns the value of this URLConnection's doInput flag. getDoOutput(). Method in class java.net.URLConnection Returns the value of this URLConnection's doOutput flag. getDouble(int). Method in interface java.sql.CallableStatement Get the value of a DOUBLE parameter as a Java double. getDouble(int). Method in interface java.sql.ResultSet Get the value of a column in the current row as a Java double. getDouble(Object). Method in class java.lang.reflect.Field Get the value of a field as a double on specified object. getDouble(Object, int). Static method in class java.lang.reflect.Array Returns the value of the indexed component in the specified array object, as a double. getDouble(String). Method in interface java.sql.ResultSet Get the value of a column in the current row as a Java double. getDriver(String). Static method in class java.sql.DriverManager Attempt to locate a driver that understands the given URL. getDriverMajorVersion(). Method in interface java.sql.DatabaseMetaData What's this JDBC driver's major version number? getDriverMinorVersion(). Method in interface java.sql.DatabaseMetaData What's this JDBC driver's minor version number? getDriverName(). Method in interface java.sql.DatabaseMetaData What's the name of this JDBC driver? getDrivers(). Static method in class java.sql.DriverManager Return an Enumeration of all the currently loaded JDBC drivers which the current caller has access to. getDriverVersion(). Method in interface java.sql.DatabaseMetaData

ww w. ja

va
333

dil

i.c o

m

334
What's the version of this JDBC driver? getEchoChar(). Method in class java.awt.TextField Returns the character to be used for echoing. getEditorSearchPath(). Static method in class java.beans.PropertyEditorManager getElement(int). Method in class sun.tools.debug.RemoteArray Return an array element. getElements(). Method in class sun.tools.debug.RemoteArray Returns a copy of the array as instances of RemoteValue. getElements(int, int). Method in class sun.tools.debug.RemoteArray Returns a copy of a portion of the array as instances of RemoteValue. getElementType(). Method in class sun.tools.debug.RemoteArray Return the element type as a "TC_" constant, such as "TC_CHAR". getEncoded(). Method in interface java.security.Key Returns the encoded key. getEncoding(). Method in class java.io.InputStreamReader Return the name of the encoding being used by this stream. getEncoding(). Method in class java.io.OutputStreamWriter Return the name of the encoding being used by this stream. getEndIndex(). Method in interface java.text.CharacterIterator Return the end index of the text. getEndIndex(). Method in class java.text.FieldPosition Retrieve the index of the character following the last character in the requested field. getEndIndex(). Method in class java.text.StringCharacterIterator Return the end index of the text. getEntry(String). Method in class java.util.zip.ZipFile Returns the ZIP file entry for the given path name. getenv(String). Static method in class java.lang.System Gets an environment variable. getEras(). Method in class java.text.DateFormatSymbols Gets era strings. getErrorCode(). Method in class java.sql.SQLException Get the vendor specific exception code getErrorOffset(). Method in class java.text.FormatException Returns the position where the error was found. getErrorOffset(). Method in class java.text.ParseException Returns the position where the error was found. getErrorsAny(). Method in class java.awt.MediaTracker Returns a list of all media that have encountered an error. getErrorsID(int). Method in class java.awt.MediaTracker Returns a list of media with the specified ID that have encountered an error. getErrorStream(). Method in class java.lang.Process Gets the error stream of the subprocess. getEventSetDescriptors(). Method in interface java.beans.BeanInfo getEventSetDescriptors(). Method in class java.beans.SimpleBeanInfo Deny knowledge of event sets. getException(). Method in class java.lang.ExceptionInInitializerError Returns the exception that occurred during a static initialization that caused this Error to be created. getExceptionCatchList(). Method in class sun.tools.debug.RemoteDebugger Return the list of the exceptions the debugger will stop on. getExceptionTypes(). Method in class java.lang.reflect.Constructor Returns an array of Class objects that represent the types of the checked exceptions thrown by the underlying constructor represented by this Constructor object. getExceptionTypes(). Method in class java.lang.reflect.Method Returns an array of Class objects that represent the types of the checked exceptions thrown by the underlying method represented by this Method object. getExpiration(). Method in class java.net.URLConnection Returns the value of the expires header field. getExportedKeys(String, String, String). Method in interface java.sql.DatabaseMetaData Get a description of the foreign key columns that reference a table's primary key columns (the foreign keys exported by a table). getExtra(). Method in class java.util.zip.ZipEntry Returns the extra field data for the entry, or null if none. getExtraNameCharacters(). Method in interface java.sql.DatabaseMetaData Get all the "extra" characters that can be used in unquoted identifier names (those beyond a-z, A-Z, 0-9 and _). getFailureHandler(). Static method in class java.rmi.server.RMISocketFactory Returns the handler for socket creation failure. getFamily(). Method in class java.awt.Font Gets the platform specific family name of the font. getFD(). Method in class java.io.FileInputStream Returns the opaque file descriptor object associated with this stream. getFD(). Method in class java.io.FileOutputStream Returns the file descriptor associated with this stream. getFD(). Method in class java.io.RandomAccessFile Returns the opaque file descriptor object associated with this stream. getField(). Method in class java.text.FieldPosition Retrieve the field identifier.

ww w. ja

va
334

dil

i.c o

m

335
getField(int). Method in class sun.tools.debug.RemoteClass Return the static field, specified by index. getField(int). Method in class sun.tools.debug.RemoteObject Return an instance variable, specified by slot number. getField(String). Method in class java.lang.Class Returns a Field object that reflects the specified public member field of the class or interface represented by this Class object. getField(String). Method in class sun.tools.debug.RemoteClass Return the static field, specified by name. getField(String). Method in class sun.tools.debug.RemoteObject Return an instance variable, specified by name. getFields(). Method in class java.lang.Class Returns an array containing Field objects reflecting all the accessible public fields of the class or interface represented by this Class object. getFields(). Method in class sun.tools.debug.RemoteClass Return all the static fields for this class. getFields(). Method in class sun.tools.debug.RemoteObject Return the instance (non-static) fields of an object. getFieldValue(int). Method in class sun.tools.debug.RemoteClass Return the value of a static field, specified by its index. getFieldValue(int). Method in class sun.tools.debug.RemoteObject Returns the value of an object's instance variable. getFieldValue(String). Method in class sun.tools.debug.RemoteClass Return the value of a static field, specified by name. getFieldValue(String). Method in class sun.tools.debug.RemoteObject Returns the value of an object's instance variable. getFile(). Method in class java.awt.FileDialog Gets the file of the Dialog. getFile(). Method in class java.net.URL Returns the file name of this URL. getFileDescriptor(). Method in class java.net.DatagramSocketImpl Get the datagram socket file descriptor getFileDescriptor(). Method in class java.net.SocketImpl Returns the value of this socket's fd field. getFilenameFilter(). Method in class java.awt.FileDialog Gets the filter. getFilePointer(). Method in class java.io.RandomAccessFile Returns the current offset in this file. getFilterInstance(ImageConsumer). Method in class java.awt.image.ImageFilter Returns a unique instance of an ImageFilter object which will actually perform the filtering for the specified ImageConsumer. getFirstDayOfWeek(). Method in class java.util.Calendar Gets what the first day of the week is; e.g., Sunday in US, Monday in France. getFloat(int). Method in interface java.sql.CallableStatement Get the value of a FLOAT parameter as a Java float. getFloat(int). Method in interface java.sql.ResultSet Get the value of a column in the current row as a Java float. getFloat(Object). Method in class java.lang.reflect.Field Get the value of a field as a float on specified object. getFloat(Object, int). Static method in class java.lang.reflect.Array Returns the value of the indexed component in the specified array object, as a float. getFloat(String). Method in interface java.sql.ResultSet Get the value of a column in the current row as a Java float. getFocusOwner(). Method in class java.awt.Window Returns the child component of this Window which has focus if and only if this Window is active. getFollowRedirects(). Static method in class java.net.HttpURLConnection getFont(). Method in class java.awt.Component Gets the font of the component. getFont(). Method in class java.awt.FontMetrics Gets the font. getFont(). Method in class java.awt.Graphics Gets the current font. getFont(). Method in class java.awt.MenuComponent Gets the font used for this MenuItem. getFont(). Method in interface java.awt.MenuContainer getFont(String). Static method in class java.awt.Font Gets a font from the system properties list. getFont(String, Font). Static method in class java.awt.Font Gets the specified font from the system properties list. getFontList(). Method in class java.awt.Toolkit Returns the names of the available fonts. For 1.1, the following font names are deprecated (the replacement name follows): TimesRoman (use Serif) Helvetica (use SansSerif) Courier (use Monospaced) The ZapfDingbats font is also deprecated in 1.1, but only as a separate fontname.

ww w. ja

va
335

dil

i.c o

m

336
getFontMetrics(). Method in class java.awt.Graphics Gets the font metrics of the current font. getFontMetrics(Font). Method in class java.awt.Component Gets the font metrics for this component. getFontMetrics(Font). Method in interface java.awt.peer.ComponentPeer getFontMetrics(Font). Method in class java.awt.Graphics Gets the font metrics for the specified font. getFontMetrics(Font). Method in class java.awt.Toolkit Returns the screen metrics of the font. getFontPeer(String, int). Method in class java.awt.Toolkit Uses the specified Peer interface to create a new Font. getForeground(). Method in class java.awt.Component Gets the foreground color. getFormat(). Method in interface java.security.Certificate Returns the name of the coding format. getFormat(). Method in interface java.security.Key Returns the format used to encode the key or null if the key does not support encoding. getFormats(). Method in class java.text.ChoiceFormat Get the formats passed in the constructor. getFormats(). Method in class java.text.MessageFormat Gets formats that were set with setFormats. getG(). Method in interface java.security.interfaces.DSAParams Returns the base, g. getGraphics(). Method in class java.awt.Component Gets a Graphics context for this component. getGraphics(). Method in interface java.awt.peer.ComponentPeer getGraphics(). Method in class java.awt.Image Gets a graphics object to draw into this image. getGraphics(). Method in class java.awt.PrintJob Gets a Graphics object that will draw to the next page. getGreatestMinimum(int). Method in class java.util.Calendar Gets the highest minimum value for the given field if varies. getGreatestMinimum(int). Method in class java.util.GregorianCalendar Returns highest minimum value for the given field if varies. getGreen(). Method in class java.awt.Color Gets the green component. getGreen(int). Method in class java.awt.image.ColorModel The subclass must provide a function which provides the green color compoment for the specified pixel. getGreen(int). Method in class java.awt.image.DirectColorModel Returns the green color compoment for the specified pixel in the range 0-255. getGreen(int). Method in class java.awt.image.IndexColorModel Returns the green color compoment for the specified pixel in the range 0-255. getGreenMask(). Method in class java.awt.image.DirectColorModel Returns the mask indicating which bits in a pixel contain the green color component. getGreens(byte[]). Method in class java.awt.image.IndexColorModel Copies the array of green color components into the given array. getGregorianChange(). Method in class java.util.GregorianCalendar Gets the Gregorian Calendar change date. getGroupingSeparator(). Method in class java.text.DecimalFormatSymbols character used for thousands separator. getGroupingSize(). Method in class java.text.DecimalFormat Return the grouping size. getGuarantor(). Method in interface java.security.Certificate Returns the guarantor of the certificate, that is, the principal guaranteeing that the public key associated with this certificate is that of the principal associated with this certificate. getHAdjustable(). Method in class java.awt.ScrollPane Returns the Adjustable object which represents the state of the horizontal scrollbar. getHeaderField(int). Method in class java.net.URLConnection Returns the value for the nth header field. getHeaderField(String). Method in class java.net.URLConnection Returns the name of the specified header field. getHeaderFieldDate(String, long). Method in class java.net.URLConnection Returns the value of the named field parsed as date. getHeaderFieldInt(String, int). Method in class java.net.URLConnection Returns the value of the named field parsed as a number. getHeaderFieldKey(int). Method in class java.net.URLConnection Returns the key for the nth header field. getHeight(). Method in class java.awt.FontMetrics Gets the standard height of a line of text in this font. getHeight(). Method in class java.awt.image.PixelGrabber Get the height of the pixel buffer (after adjusting for image height). getHeight(ImageObserver). Method in class java.awt.Image Gets the actual height of the image. getHelpMenu(). Method in class java.awt.MenuBar Gets the help menu on the menu bar. getHgap(). Method in class java.awt.BorderLayout

ww w. ja

va
336

dil

i.c o

m

337
Returns the horizontal gap between components. getHgap(). Method in class java.awt.CardLayout Returns the horizontal gap between components. getHgap(). Method in class java.awt.FlowLayout Returns the horizontal gap between components. getHgap(). Method in class java.awt.GridLayout Returns the horizontal gap between components. getHost(). Method in class java.net.URL Returns the host name of this URL, if applicable. getHostAddress(). Method in class java.net.InetAddress Returns the IP address string "%d.%d.%d.%d" getHostName(). Method in class java.net.InetAddress Returns the hostname for this address. getHours(). Method in class java.sql.Date Returns the hour represented by this date. getHours(). Method in class java.util.Date Returns the hour represented by this date. getHSBColor(float, float, float). Static method in class java.awt.Color A static Color factory for generating a Color object from HSB values. getHScrollbarHeight(). Method in class java.awt.ScrollPane Returns the height that would be occupied by a horizontal scrollbar, which is independent of whether it is currently displayed by the scroll pane or not. getHScrollbarHeight(). Method in interface java.awt.peer.ScrollPanePeer getHumanPresentableName(). Method in class java.awt.datatransfer.DataFlavor Returns the human presentable name for the data foramt that this DataFlavor represents. getIcon(int). Method in interface java.beans.BeanInfo This method returns an image object that can be used to represent the bean in toolboxes, toolbars, etc. getIcon(int). Method in class java.beans.SimpleBeanInfo Claim there are no icons available. getIconImage(). Method in class java.awt.Frame Returns the icon image for this Frame. getID(). Method in class java.awt.AWTEvent Returns the event type. getId(). Method in class sun.tools.debug.RemoteObject Returns the id of the object. getID(). Method in class java.util.TimeZone Gets the ID of this time zone. getIdentifierQuoteString(). Method in interface java.sql.DatabaseMetaData What's the string used to quote SQL identifiers? This returns a space " " if identifier quoting isn't supported. getIdentity(Principal). Method in class java.security.IdentityScope Retrieves the identity whose name is the same as that of the specified principal. getIdentity(PublicKey). Method in class java.security.IdentityScope Retrieves the identity with the specified public key. getIdentity(String). Method in class java.security.IdentityScope Returns the identity in this scope with the specified name (if any). getIfModifiedSince(). Method in class java.net.URLConnection Returns the value of this object's ifModifiedSince field. getImage(String). Method in class java.awt.Toolkit Returns an image which gets pixel data from the specified file. getImage(URL). Method in class java.applet.Applet Returns an Image object that can then be painted on the screen. getImage(URL). Method in interface java.applet.AppletContext Returns an Image object that can then be painted on the screen. getImage(URL). Method in class java.awt.Toolkit Returns an image which gets pixel data from the specified URL. getImage(URL, String). Method in class java.applet.Applet Returns an Image object that can then be painted on the screen. getImportedKeys(String, String, String). Method in interface java.sql.DatabaseMetaData Get a description of the primary key columns that are referenced by a table's foreign key columns (the primary keys imported by a table). getInCheck(). Method in class java.lang.SecurityManager Tests if there is a security check in progress. getIndex(). Method in interface java.text.CharacterIterator Return the current index. getIndex(). Method in class java.sql.DataTruncation Get the index of the column or parameter that was truncated. getIndex(). Method in class java.text.ParsePosition Retrieve the current parse position. getIndex(). Method in class java.text.StringCharacterIterator Return the current index. getIndexedPropertyType(). Method in class java.beans.IndexedPropertyDescriptor getIndexedReadMethod(). Method in class java.beans.IndexedPropertyDescriptor getIndexedWriteMethod(). Method in class java.beans.IndexedPropertyDescriptor getIndexInfo(String, String, String, boolean, boolean). Method in interface java.sql.DatabaseMetaData Get a description of a table's indices and statistics. getInetAddress(). Method in class java.net.ServerSocket

ww w. ja

va
337

dil

i.c o

m

338
Returns the local address of this server socket. getInetAddress(). Method in class java.net.Socket Returns the address to which the socket is connected. getInetAddress(). Method in class java.net.SocketImpl Returns the value of this socket's address field. getInfinity(). Method in class java.text.DecimalFormatSymbols character used to represent infinity. getInfo(). Method in class java.security.Identity Returns general information previously specified for this identity. getInfo(). Method in class java.security.Provider Returns a human-readable description of the provider and its services. getInputStream(). Method in class java.lang.Process Gets the input stream of the subprocess. getInputStream(). Method in interface java.rmi.server.RemoteCall Get the InputStream that the stub/skeleton should get results/arguments from. getInputStream(). Method in class java.net.Socket Returns an input stream for this socket. getInputStream(). Method in class java.net.SocketImpl Returns an input stream for this socket. getInputStream(). Method in class java.net.URLConnection Returns an input stream that reads from this open connection. getInputStream(ZipEntry). Method in class java.util.zip.ZipFile Returns an input stream for reading the contents of the specified ZIP file entry. getInsets(). Method in class java.awt.Container Returns the insets of the container. getInsets(). Method in interface java.awt.peer.ContainerPeer getInstance(). Static method in class java.util.Calendar Gets a Calendar using the default timezone and locale. getInstance(). Static method in class java.text.Collator Gets the Collator for the current default locale. getInstance(). Static method in class java.text.DateFormat Get a default date/time formatter that uses the SHORT style for both the date and the time. getInstance(). Static method in class java.text.NumberFormat Returns the default number format for the current default locale. getInstance(Locale). Static method in class java.util.Calendar Gets a Calendar using the default timezone and given locale. getInstance(Locale). Static method in class java.text.Collator Gets the Collator for the desired locale. getInstance(Locale). Static method in class java.text.NumberFormat Returns the default number format for the specified locale. getInstance(String). Static method in class java.security.KeyPairGenerator Generates a KeyPairGenerator object that implements the algorithm requested, as available in the environment. getInstance(String). Static method in class java.security.MessageDigest Generates a MessageDigest object that implements the specified digest algorithm. getInstance(String). Static method in class java.security.Signature Generates a Signature object that implements the specified algorithm. getInstance(String, String). Static method in class java.security.KeyPairGenerator Generates a KeyPairGenerator object implementing the specified algorithm, as supplied from the specified provider, if such an algorithm is available from the provider. getInstance(String, String). Static method in class java.security.MessageDigest Generates a MessageDigest object implementing the specified algorithm, as supplied from the specified provider, if such an algorithm is available from the provider. getInstance(String, String). Static method in class java.security.Signature Generates a Signature object implementing the specified algorithm, as supplied from the specified provider, if such an algorithm is available from the provider. getInstance(TimeZone). Static method in class java.util.Calendar Gets a Calendar using the given timezone and default locale. getInstance(TimeZone, Locale). Static method in class java.util.Calendar Gets a Calendar using the given timezone and given locale. getInstanceField(int). Method in class sun.tools.debug.RemoteClass Return the instance field, specified by its index. getInstanceFields(). Method in class sun.tools.debug.RemoteClass Return all the instance fields for this class. getInstanceOf(Object, Class). Static method in class java.beans.Beans From a given bean, obtain an object representing a specified type view of that source object. getInt(int). Method in interface java.sql.CallableStatement Get the value of an INTEGER parameter as a Java int. getInt(int). Method in interface java.sql.ResultSet Get the value of a column in the current row as a Java int. getInt(Object). Method in class java.lang.reflect.Field Get the value of a field as a int on specified object. getInt(Object, int). Static method in class java.lang.reflect.Array Returns the value of the indexed component in the specified array object, as an int. getInt(String). Method in interface java.sql.ResultSet Get the value of a column in the current row as a Java int. getInteger(String). Static method in class java.lang.Integer

ww w. ja

va
338

dil

i.c o

m

339
Determines the integer value of the system property with the specified name. getInteger(String, int). Static method in class java.lang.Integer Determines the integer value of the system property with the specified name. getInteger(String, Integer). Static method in class java.lang.Integer Determines the integer value of the system property with the specified name. getInterface(). Method in class java.net.MulticastSocket Retrieve the address of the network interface used for multicast packets. getInterfaces(). Method in class java.lang.Class Determines the interfaces implemented by the class or interface represented by this object. getInterfaces(). Method in class sun.tools.debug.RemoteClass Return the interfaces for this class. getISO3Country(). Method in class java.util.Locale Getter for the three-letter ISO country abbreviation of the locale. getISO3Language(). Method in class java.util.Locale Getter for the three-letter ISO language abbreviation of the locale. getItem(). Method in class java.awt.event.ItemEvent Returns the item where the event occurred. getItem(int). Method in class java.awt.Choice Returns the String at the specified index in the Choice. getItem(int). Method in class java.awt.List Gets the item associated with the specified index. getItem(int). Method in class java.awt.Menu Returns the item located at the specified index of this menu. getItemCount(). Method in class java.awt.Choice Returns the number of items in this Choice. getItemCount(). Method in class java.awt.List Returns the number of items in the list. getItemCount(). Method in class java.awt.Menu Returns the number of elements in this menu. getItems(). Method in class java.awt.List Returns the items in the list. getItemSelectable(). Method in class java.awt.event.ItemEvent Returns the ItemSelectable object where this event originated. getJavaInitializationString(). Method in interface java.beans.PropertyEditor This method is intended for use when generating Java code to set the value of the property. getJavaInitializationString(). Method in class java.beans.PropertyEditorSupport This method is intended for use when generating Java code to set the value of the property. getKey(). Method in class java.awt.MenuShortcut Return the raw keycode of this MenuShortcut. getKey(). Method in class java.util.MissingResourceException Gets parameter passed by constructor. getKeyChar(). Method in class java.awt.event.KeyEvent Returns the character associated with the key in this event. getKeyCode(). Method in class java.awt.event.KeyEvent Returns the integer key-code associated with the key in this event. getKeyModifiersText(int). Static method in class java.awt.event.KeyEvent Returns a String describing the modifier key(s), such as "Shift", or "Ctrl+Shift". getKeys(). Method in class java.util.ListResourceBundle Implementation of ResourceBundle.getKeys. getKeys(). Method in class java.util.PropertyResourceBundle Implementation of ResourceBundle.getKeys. getKeys(). Method in class java.util.ResourceBundle Return an enumeration of the keys. getKeyText(int). Static method in class java.awt.event.KeyEvent Returns a String describing the keyCode, such as "HOME", "F1" or "A". getLabel(). Method in class java.awt.Button Gets the label of the button. getLabel(). Method in class java.awt.Checkbox Gets the label of the check box. getLabel(). Method in class java.awt.MenuItem Gets the label for this menu item. getLanguage(). Method in class java.util.Locale Getter for programmatic name of field, an lowercased two-letter ISO-639 code. getLastModified(). Method in class java.net.URLConnection Returns the value of the last-modified header field. getLayout(). Method in class java.awt.Container Gets the layout manager for this container. getLayoutAlignmentX(Container). Method in class java.awt.BorderLayout Returns the alignment along the x axis. getLayoutAlignmentX(Container). Method in class java.awt.CardLayout Returns the alignment along the x axis. getLayoutAlignmentX(Container). Method in class java.awt.GridBagLayout Returns the alignment along the x axis. getLayoutAlignmentX(Container). Method in interface java.awt.LayoutManager2 Returns the alignment along the x axis. getLayoutAlignmentY(Container). Method in class java.awt.BorderLayout

ww w. ja

va
339

dil

i.c o

m

340
Returns the alignment along the y axis. getLayoutAlignmentY(Container). Method in class java.awt.CardLayout Returns the alignment along the y axis. getLayoutAlignmentY(Container). Method in class java.awt.GridBagLayout Returns the alignment along the y axis. getLayoutAlignmentY(Container). Method in interface java.awt.LayoutManager2 Returns the alignment along the y axis. getLayoutDimensions(). Method in class java.awt.GridBagLayout GetLayoutInfo(Container, int). Method in class java.awt.GridBagLayout Print the layout constraints. getLayoutOrigin(). Method in class java.awt.GridBagLayout getLayoutWeights(). Method in class java.awt.GridBagLayout getLeading(). Method in class java.awt.FontMetrics Gets the standard leading, or line spacing, for the font. getLeastMaximum(int). Method in class java.util.Calendar Gets the lowest maximum value for the given field if varies. getLeastMaximum(int). Method in class java.util.GregorianCalendar Returns lowest maximum value for the given field if varies. getLength(). Method in class java.net.DatagramPacket Returns the length of the data to be sent or the length of the data received. getLength(Object). Static method in class java.lang.reflect.Array Returns the length of the specified array object, as an int. getLimits(). Method in class java.text.ChoiceFormat Get the limits passed in the constructor. getLineIncrement(). Method in class java.awt.Scrollbar getLineInstance(). Static method in class java.text.BreakIterator Create BreakIterator for line-breaks using default locale. getLineInstance(Locale). Static method in class java.text.BreakIterator Create BreakIterator for line-breaks using default locale. getLineNumber(). Method in class java.io.LineNumberInputStream Returns the current line number. getLineNumber(). Method in class java.io.LineNumberReader Get the current line number. getLineNumber(). Method in class sun.tools.debug.RemoteStackFrame Return the source file line number. getLineNumbers(). Method in class sun.tools.debug.RemoteClass Return an array of all the class's source file line numbers which have code associated with them. getListenerMethodDescriptors(). Method in class java.beans.EventSetDescriptor getListenerMethods(). Method in class java.beans.EventSetDescriptor getListenerType(). Method in class java.beans.EventSetDescriptor getLocalAddress(). Method in class java.net.DatagramSocket Gets the local address to which the socket is bound. getLocalAddress(). Method in class java.net.Socket Gets the local address to which the socket is bound. getLocale(). Method in class java.applet.Applet Gets the Locale for the applet, if it has been set. getLocale(). Method in class java.awt.Component Gets the locale of the component. getLocale(). Method in class java.text.MessageFormat Gets the locale. getLocale(). Method in class java.awt.Window Gets the Locale for the window, if it has been set. getLocalHost(). Static method in class java.net.InetAddress Returns the local host. getLocalizedInputStream(InputStream). Method in class java.lang.Runtime Creates a localized version of an input stream. getLocalizedMessage(). Method in class java.lang.Throwable Creates a localized description of this Throwable. getLocalizedOutputStream(OutputStream). Method in class java.lang.Runtime Creates a localized version of an output stream. getLocalPatternChars(). Method in class java.text.DateFormatSymbols Gets localized date-time pattern characters. getLocalPort(). Method in class java.net.DatagramSocket Returns the port number on the local host to which this socket is bound. getLocalPort(). Method in class java.net.DatagramSocketImpl Get the local port. getLocalPort(). Method in class java.net.ServerSocket Returns the port on which this socket is listening. getLocalPort(). Method in class java.net.Socket Returns the local port to which this socket is bound. getLocalPort(). Method in class java.net.SocketImpl Returns the value of this socket's localport field. getLocalVariable(String). Method in class sun.tools.debug.RemoteStackFrame Return a specific (named) stack variable. getLocalVariables(). Method in class sun.tools.debug.RemoteStackFrame Return an array of all valid local variables and method arguments for this stack frame.

ww w. ja

va
340

dil

i.c o

m

341
getLocation(). Method in class java.awt.Component Returns the current location of this component. getLocation(). Method in class java.awt.Point Returns the location of this point. getLocation(). Method in class java.awt.Rectangle Returns the location of this rectangle. getLocationOnScreen(). Method in class java.awt.Component Returns the current location of this component in the screen's coordinate space. getLocationOnScreen(). Method in interface java.awt.peer.ComponentPeer getLog(). Static method in class java.rmi.server.RemoteServer Returns stream for the RMI call log. getLoginTimeout(). Static method in class java.sql.DriverManager Get the maximum time in seconds that all drivers can wait when attempting to log in to a database. getLogStream(). Static method in class java.sql.DriverManager Get the logging/tracing PrintStream that is used by the DriverManager and all drivers. getLong(int). Method in interface java.sql.CallableStatement Get the value of a BIGINT parameter as a Java long. getLong(int). Method in interface java.sql.ResultSet Get the value of a column in the current row as a Java long. getLong(Object). Method in class java.lang.reflect.Field Get the value of a field as a long on specified object. getLong(Object, int). Static method in class java.lang.reflect.Array Returns the value of the indexed component in the specified array object, as a long. getLong(String). Static method in class java.lang.Long Determines the long value of the system property with the specified name. getLong(String). Method in interface java.sql.ResultSet Get the value of a column in the current row as a Java long. getLong(String, Long). Static method in class java.lang.Long Determines the long value of the system property with the specified name. getLong(String, long). Static method in class java.lang.Long Determines the long value of the system property with the specified name. getLowestSetBit(). Method in class java.math.BigInteger Returns the index of the rightmost (lowest-order) one bit in this number (i.e., the number of zero bits to the right of the rightmost one bit). getMajorVersion(). Method in interface java.sql.Driver Get the driver's major version number. getMapSize(). Method in class java.awt.image.IndexColorModel Returns the size of the color component arrays in this IndexColorModel. getMaxAdvance(). Method in class java.awt.FontMetrics Gets the maximum advance width of any character in this Font. getMaxAscent(). Method in class java.awt.FontMetrics Gets the maximum ascent of all characters in this Font. getMaxBinaryLiteralLength(). Method in interface java.sql.DatabaseMetaData How many hex characters can you have in an inline binary literal? getMaxCatalogNameLength(). Method in interface java.sql.DatabaseMetaData What's the maximum length of a catalog name? getMaxCharLiteralLength(). Method in interface java.sql.DatabaseMetaData What's the max length for a character literal? getMaxColumnNameLength(). Method in interface java.sql.DatabaseMetaData What's the limit on column name length? getMaxColumnsInGroupBy(). Method in interface java.sql.DatabaseMetaData What's the maximum number of columns in a "GROUP BY" clause? getMaxColumnsInIndex(). Method in interface java.sql.DatabaseMetaData What's the maximum number of columns allowed in an index? getMaxColumnsInOrderBy(). Method in interface java.sql.DatabaseMetaData What's the maximum number of columns in an "ORDER BY" clause? getMaxColumnsInSelect(). Method in interface java.sql.DatabaseMetaData What's the maximum number of columns in a "SELECT" list? getMaxColumnsInTable(). Method in interface java.sql.DatabaseMetaData What's the maximum number of columns in a table? getMaxConnections(). Method in interface java.sql.DatabaseMetaData How many active connections can we have at a time to this database? getMaxCursorNameLength(). Method in interface java.sql.DatabaseMetaData What's the maximum cursor name length? getMaxDecent(). Method in class java.awt.FontMetrics For backward compatibility only. getMaxDescent(). Method in class java.awt.FontMetrics Gets the maximum descent of all characters in this Font. getMaxFieldSize(). Method in interface java.sql.Statement The maxFieldSize limit (in bytes) is the maximum amount of data returned for any column value; it only applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR columns. getMaximum(). Method in interface java.awt.Adjustable Gets the maximum value of the adjustable object. getMaximum(). Method in class java.awt.Scrollbar Returns the maximum value of this Scrollbar. getMaximum(int). Method in class java.util.Calendar

ww w. ja

va
341

dil

i.c o

m

342
Gets the maximum value for the given time field. getMaximum(int). Method in class java.util.GregorianCalendar Returns maximum value for the given field. getMaximumFractionDigits(). Method in class java.text.NumberFormat Returns the maximum number of digits allowed in the fraction portion of a number. getMaximumIntegerDigits(). Method in class java.text.NumberFormat Returns the maximum number of digits allowed in the integer portion of a number. getMaximumSize(). Method in class java.awt.Component Returns the maximum size of this component. getMaximumSize(). Method in class java.awt.Container Returns the maximum size of this container. getMaxIndexLength(). Method in interface java.sql.DatabaseMetaData What's the maximum length of an index (in bytes)? getMaxPriority(). Method in class java.lang.ThreadGroup Returns the maximum priority of this thread group. getMaxProcedureNameLength(). Method in interface java.sql.DatabaseMetaData What's the maximum length of a procedure name? getMaxRows(). Method in interface java.sql.Statement The maxRows limit is the maximum number of rows that a ResultSet can contain. getMaxRowSize(). Method in interface java.sql.DatabaseMetaData What's the maximum length of a single row? getMaxSchemaNameLength(). Method in interface java.sql.DatabaseMetaData What's the maximum length allowed for a schema name? getMaxStatementLength(). Method in interface java.sql.DatabaseMetaData What's the maximum length of a SQL statement? getMaxStatements(). Method in interface java.sql.DatabaseMetaData How many active statements can we have open at one time to this database? getMaxTableNameLength(). Method in interface java.sql.DatabaseMetaData What's the maximum length of a table name? getMaxTablesInSelect(). Method in interface java.sql.DatabaseMetaData What's the maximum number of tables in a SELECT? getMaxUserNameLength(). Method in interface java.sql.DatabaseMetaData What's the maximum length of a user name? getMenu(int). Method in class java.awt.MenuBar Gets the specified menu. getMenu(String). Method in class java.util.ResourceBundle Get an object from a ResourceBundle. getMenuBar(). Method in class java.awt.Frame Gets the menu bar for this Frame. getMenuBar(String). Method in class java.util.ResourceBundle Get an object from a ResourceBundle. getMenuCount(). Method in class java.awt.MenuBar Counts the number of menus on the menu bar. getMenuShortcutKeyMask(). Method in class java.awt.Toolkit Return the Event modifier mask appropriate for shortcuts. getMessage(). Method in class java.io.InvalidClassException Produce the message, include the classname if present. getMessage(). Method in class java.rmi.RemoteException Produce the message, include the message from the nested exception if there is one. getMessage(). Method in class java.rmi.server.ServerCloneException Produce the message, include the message from the nested exception if there is one. getMessage(). Method in class java.lang.Throwable Returns the detail message of this throwable object. getMessage(). Method in class java.io.WriteAbortedException Produce the message, include the message from the nested exception if there is one. getMessageDigest(). Method in class java.security.DigestInputStream Returns the message digest associated with this stream. getMessageDigest(). Method in class java.security.DigestOutputStream Returns the message digest associated with this stream. getMetaData(). Method in interface java.sql.Connection A Connection's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, etc. getMetaData(). Method in interface java.sql.ResultSet The number, types and properties of a ResultSet's columns are provided by the getMetaData method. getMethod(). Method in class java.beans.MethodDescriptor getMethod(). Method in class java.util.zip.ZipEntry Returns the compression method of the entry, or -1 if not specified. getMethod(String). Method in class sun.tools.debug.RemoteClass Return the method, specified by name. getMethod(String, Class[]). Method in class java.lang.Class Returns a Method object that reflects the specified public member method of the class or interface represented by this Class object. getMethodDescriptors(). Method in interface java.beans.BeanInfo getMethodDescriptors(). Method in class java.beans.SimpleBeanInfo Deny knowledge of methods. getMethodLineNumber(int). Method in class sun.tools.debug.RemoteClass

ww w. ja

va
342

dil

i.c o

m

343
Return the first line number of the specified method, or throws NoSuchLineNumber exception. getMethodLineNumber(String). Method in class sun.tools.debug.RemoteClass Return the first line number of the specified method, or throws NoSuchLineNumber exception. getMethodName(). Method in class sun.tools.debug.RemoteStackFrame Get the method name referenced by this stackframe. getMethodNames(). Method in class sun.tools.debug.RemoteClass Return the names of all methods supported by this class. getMethods(). Method in class java.lang.Class Returns an array containing Method objects reflecting all the public member methods of the class or interface represented by this Class object, including those declared by the class or interface and and those inherited from superclasses and superinterfaces. getMethods(). Method in class sun.tools.debug.RemoteClass Return the class's methods. getMimeType(). Method in class java.awt.datatransfer.DataFlavor Returns the MIME type string for this DataFlavor getMinimalDaysInFirstWeek(). Method in class java.util.Calendar Gets what the minimal days required in the first week of the year are; e.g., if the first week is defined as one that contains the first day of the first month of a year, getMinimalDaysInFirstWeek returns 1. getMinimum(). Method in interface java.awt.Adjustable Gets the minimum value of the adjustable object. getMinimum(). Method in class java.awt.Scrollbar Returns the minimum value of this Scrollbar. getMinimum(int). Method in class java.util.Calendar Gets the minimum value for the given time field. getMinimum(int). Method in class java.util.GregorianCalendar Returns minimum value for the given field. getMinimumFractionDigits(). Method in class java.text.NumberFormat Returns the minimum number of digits allowed in the fraction portion of a number. getMinimumIntegerDigits(). Method in class java.text.NumberFormat Returns the minimum number of digits allowed in the integer portion of a number. getMinimumSize(). Method in class java.awt.Component Returns the mininimum size of this component. getMinimumSize(). Method in interface java.awt.peer.ComponentPeer getMinimumSize(). Method in class java.awt.Container Returns the minimum size of this container. getMinimumSize(). Method in class java.awt.List Returns the minimum dimensions needed for the list. getMinimumSize(). Method in class java.awt.TextArea Returns the minimum size Dimensions of the TextArea. getMinimumSize(). Method in class java.awt.TextField Returns the minimum size Dimensions needed for this TextField. getMinimumSize(int). Method in class java.awt.List Returns the minimum dimensions needed for the amount of rows in the list. getMinimumSize(int). Method in interface java.awt.peer.ListPeer getMinimumSize(int). Method in class java.awt.TextField Returns the minimum size Dimensions needed for this TextField with the specified amount of columns. getMinimumSize(int). Method in interface java.awt.peer.TextFieldPeer getMinimumSize(int, int). Method in class java.awt.TextArea Returns the specified minimum size Dimensions of the TextArea. getMinimumSize(int, int). Method in interface java.awt.peer.TextAreaPeer getMinorVersion(). Method in interface java.sql.Driver Get the driver's minor version number. GetMinSize(Container, GridBagLayoutInfo). Method in class java.awt.GridBagLayout getMinusSign(). Method in class java.text.DecimalFormatSymbols character used to represent minus sign. getMinutes(). Method in class java.sql.Date Returns the number of minutes past the hour represented by this date. getMinutes(). Method in class java.util.Date Returns the number of minutes past the hour represented by this date. getMode(). Method in class java.awt.FileDialog Gets the mode of the file dialog. getModifiers(). Method in class java.awt.event.ActionEvent Returns the modifiers held down during this action event. getModifiers(). Method in class java.lang.Class Returns the Java language modifiers for this class or interface, encoded in an integer. getModifiers(). Method in class java.lang.reflect.Constructor Returns the Java language modifiers for the constructor represented by this Constructor object, as an integer. getModifiers(). Method in class java.lang.reflect.Field Returns the Java language modifiers for the field represented by this Field object, as an integer. getModifiers(). Method in class java.awt.event.InputEvent Returns the modifiers flag for this event. getModifiers(). Method in interface java.lang.reflect.Member Returns the Java language modifiers for the member or constructor represented by this Member, as an integer. getModifiers(). Method in class java.lang.reflect.Method Returns the Java language modifiers for the method represented by this Method object, as an integer. getModifiers(). Method in class sun.tools.debug.RemoteField

ww w. ja

va
343

dil

i.c o

m

344
Returns a string with the field's modifiers, such as "public", "static", "final", etc. getMonth(). Method in class java.util.Date Returns the month represented by this date. getMonth(). Method in class java.sql.Time Returns the month represented by this date. getMonths(). Method in class java.text.DateFormatSymbols Gets month strings. getMoreResults(). Method in interface java.sql.Statement getMoreResults moves to a Statement's next result. getMultiplier(). Method in class java.text.DecimalFormat Get the multiplier for use in percent, permill, etc. getName(). Method in interface java.security.acl.Acl Returns the name of this ACL. getName(). Method in class java.lang.Class Returns the fully-qualified name of the type (class, interface, array, or primitive) represented by this Class object, as a String. getName(). Method in class java.awt.datatransfer.Clipboard Returns the name of this clipboard object. getName(). Method in class java.awt.Component Gets the name of the component. getName(). Method in class java.lang.reflect.Constructor Returns the name of this constructor, as a string. getName(). Method in class java.beans.FeatureDescriptor getName(). Method in class java.lang.reflect.Field Returns the name of the field represented by this Field object. getName(). Method in class java.io.File Returns the name of the file represented by this object. getName(). Method in class java.awt.Font Gets the logical name of the font. getName(). Method in class java.security.Identity Returns this identity's name. getName(). Method in interface java.lang.reflect.Member Returns the simple name of the underlying member or constructor represented by this Member. getName(). Method in class java.awt.MenuComponent Gets the name of the menu component. getName(). Method in class java.lang.reflect.Method Returns the name of the method represented by this Method object, as a String. getName(). Method in class java.io.ObjectStreamClass The name of the class described by this descriptor. getName(). Method in interface java.security.Principal Returns the name of this principal. getName(). Method in class java.security.Provider Returns the name of this provider. getName(). Method in class sun.tools.debug.RemoteClass Returns the name of the class. getName(). Method in class sun.tools.debug.RemoteField Returns the name of the field. getName(). Method in class sun.tools.debug.RemoteStackVariable Return the name of a stack variable or argument. getName(). Method in class sun.tools.debug.RemoteThread Return the name of the thread. getName(). Method in class sun.tools.debug.RemoteThreadGroup Return the threadgroup's name. getName(). Method in class java.lang.Thread Returns this thread's name. getName(). Method in class java.lang.ThreadGroup Returns the name of this thread group. getName(). Method in class java.util.zip.ZipEntry Returns the name of the entry. getName(). Method in class java.util.zip.ZipFile Returns the path name of the ZIP file. getNaN(). Method in class java.text.DecimalFormatSymbols character used to represent NaN. getNanos(). Method in class java.sql.Timestamp Get the Timestamp's nanos value getNativeContainer(Component). Static method in class java.awt.Toolkit Give native peers the ability to query the native container given a native component (eg the direct parent may be lightweight). getNegativePrefix(). Method in class java.text.DecimalFormat Get the negative prefix. getNegativeSuffix(). Method in class java.text.DecimalFormat Get the negative suffix. getNewValue(). Method in class java.beans.PropertyChangeEvent getNextEntry(). Method in class java.util.zip.ZipInputStream Reads the next ZIP file entry and positions stream at the beginning of the entry data. getNextEvent(). Method in class java.awt.EventQueue Remove an event from the queue and return it. getNextException(). Method in class java.sql.SQLException

ww w. ja

va
344

dil

i.c o

m

345
Get the exception chained to this one. getNextWarning(). Method in class java.sql.SQLWarning Get the warning chained to this one getNumberInstance(). Method in class java.text.DateFormat Gets the number formatter which this date/time formatter uses to format and parse a time. getNumberInstance(). Static method in class java.text.NumberFormat Returns a general-purpose number format for the current default locale. getNumberInstance(Locale). Static method in class java.text.NumberFormat Returns a general-purpose number format for the specified locale. getNumericFunctions(). Method in interface java.sql.DatabaseMetaData Get a comma separated list of math functions. getNumericValue(char). Static method in class java.lang.Character Returns the Unicode numeric value of the character as a nonnegative integer. getObject(int). Method in interface java.sql.CallableStatement Get the value of a parameter as a Java object. getObject(int). Method in interface java.sql.ResultSet Get the value of a column in the current row as a Java object. getObject(String). Method in class java.util.ResourceBundle Get an object from a ResourceBundle. getObject(String). Method in interface java.sql.ResultSet

ww w. ja

Get the value of a column in the current row as a Java object. getOffset(int, int, int, int, int, int). Method in class java.util.SimpleTimeZone Overrides TimeZone Gets offset, for current date, modified in case of daylight savings. getOffset(int, int, int, int, int, int). Method in class java.util.TimeZone Gets the time zone offset, for current date, modified in case of daylight savings. getOldValue(). Method in class java.beans.PropertyChangeEvent getOperation(). Method in class java.rmi.server.Operation Returns the name of the method. getOperations(). Method in interface java.rmi.server.Skeleton getOrientation(). Method in interface java.awt.Adjustable Gets the orientation of the adjustable object. getOrientation(). Method in class java.awt.Scrollbar Returns the orientation for this Scrollbar. getOutputStream(). Method in class java.rmi.server.LogStream Return the current stream to which output from this log is sent. getOutputStream(). Method in class java.lang.Process Gets the output stream of the subprocess. getOutputStream(). Method in interface java.rmi.server.RemoteCall Return the output stream the stub/skeleton should put arguments/results into. getOutputStream(). Method in class java.net.Socket Returns an output stream for this socket. getOutputStream(). Method in class java.net.SocketImpl Returns an output stream for this socket. getOutputStream(). Method in class java.net.URLConnection Returns an output stream that writes to this connection. getP(). Method in interface java.security.interfaces.DSAParams Returns the prime, p. getPageDimension(). Method in class java.awt.PrintJob Returns the dimensions of the page in pixels. getPageIncrement(). Method in class java.awt.Scrollbar getPageResolution(). Method in class java.awt.PrintJob Returns the resolution of the page in pixels per inch. getParameter(). Method in class java.sql.DataTruncation Is this a truncated parameter value? getParameter(String). Method in class java.applet.Applet Returns the value of the named parameter in the HTML tag. getParameter(String). Method in interface java.applet.AppletStub Returns the value of the named parameter in the HTML tag. getParameter(String). Method in class java.security.Signature Gets the value of the specified algorithm parameter. getParameterDescriptors(). Method in class java.beans.MethodDescriptor getParameterInfo(). Method in class java.applet.Applet Returns information about the parameters than are understood by this applet. getParameterTypes(). Method in class java.lang.reflect.Constructor Returns an array of Class objects that represent the formal parameter types, in declaration order, of the constructor represented by this Constructor object. getParameterTypes(). Method in class java.lang.reflect.Method Returns an array of Class objects that represent the formal parameter types, in declaration order, of the method represented by this Method object. getParams(). Method in interface java.security.interfaces.DSAKey Returns the DSA-specific key parameters. getParent(). Method in class java.awt.Component Gets the parent of the component. getParent(). Method in class java.io.File

va
345

dil

i.c o

m

346
Returns the parent directory of the file represented by this object. getParent(). Method in class java.awt.MenuComponent Returns the parent container. getParent(). Method in class java.lang.ThreadGroup Returns the parent of this thread group. getPath(). Method in class java.io.File Returns the pathname of the file represented by this object. getPatternSeparator(). Method in class java.text.DecimalFormatSymbols character used to separate positive and negative subpatterns in a pattern. getPC(). Method in class sun.tools.debug.RemoteStackFrame Get the program counter referenced by this stackframe. getPeer(). Method in class java.awt.Component getPeer(). Method in class java.awt.Font Gets the peer of the font. getPeer(). Method in class java.awt.MenuComponent getPercent(). Method in class java.text.DecimalFormatSymbols character used for percent sign. getPercentInstance(). Static method in class java.text.NumberFormat Returns a percentage format for the current default locale. getPercentInstance(Locale). Static method in class java.text.NumberFormat Returns a percentage format for the specified locale. getPerMill(). Method in class java.text.DecimalFormatSymbols character used for mille percent sign. getPermissions(Principal). Method in interface java.security.acl.Acl Returns an enumeration for the set of allowed permissions for the specified principal (representing an entity such as an individual or a group). getPixels(). Method in class java.awt.image.PixelGrabber Get the pixel buffer. getPixelSize(). Method in class java.awt.image.ColorModel Returns the number of bits per pixel described by this ColorModel. getPoint(). Method in class java.awt.event.MouseEvent Returns the x,y position of the event relative to the source component. getPort(). Method in class java.net.DatagramPacket Returns the port number on the remote host to which this datagram is being sent or from which the datagram was received. getPort(). Method in class java.net.Socket Returns the remote port to which this socket is connected. getPort(). Method in class java.net.SocketImpl Returns the value of this socket's port field. getPort(). Method in class java.net.URL Returns the port number of this URL. getPositivePrefix(). Method in class java.text.DecimalFormat Get the positive prefix. getPositiveSuffix(). Method in class java.text.DecimalFormat Get the positive suffix. getPrecision(int). Method in interface java.sql.ResultSetMetaData What's a column's number of decimal digits? getPredefinedCursor(int). Static method in class java.awt.Cursor Returns a cursor object with the specified predefined type. getPreferredSize(). Method in class java.awt.Component Returns the preferred size of this component. getPreferredSize(). Method in interface java.awt.peer.ComponentPeer getPreferredSize(). Method in class java.awt.Container Returns the preferred size of this container. getPreferredSize(). Method in class java.awt.List Returns the preferred dimensions needed for the list. getPreferredSize(). Method in class java.awt.TextArea Returns the preferred size Dimensions of the TextArea. getPreferredSize(). Method in class java.awt.TextField Returns the preferred size Dimensions needed for this TextField. getPreferredSize(int). Method in class java.awt.List Returns the preferred dimensions needed for the list with the specified amount of rows. getPreferredSize(int). Method in interface java.awt.peer.ListPeer getPreferredSize(int). Method in class java.awt.TextField Returns the preferred size Dimensions needed for this TextField with the specified amount of columns. getPreferredSize(int). Method in interface java.awt.peer.TextFieldPeer getPreferredSize(int, int). Method in class java.awt.TextArea Returns the specified row and column Dimensions of the TextArea. getPreferredSize(int, int). Method in interface java.awt.peer.TextAreaPeer getPrimaryKeys(String, String, String). Method in interface java.sql.DatabaseMetaData Get a description of a table's primary key columns. getPrincipal(). Method in interface java.security.acl.AclEntry Returns the principal for which permissions are granted or denied by this ACL entry. getPrincipal(). Method in interface java.security.Certificate Returns the principal of the principal-key pair being guaranteed by the guarantor. getPrintJob(). Method in interface java.awt.PrintGraphics Returns the PrintJob object from which this PrintGraphics object originated.

ww w. ja

va
346

dil

i.c o

m

347
getPrintJob(Frame, String, Properties). Method in class java.awt.Toolkit Returns a PrintJob object which is the result of initiating a print operation on the toolkit's platform. getPriority(). Method in class java.lang.Thread Returns this thread's priority. getPrivate(). Method in class java.security.KeyPair Returns the private key from this key pair. getPrivateKey(). Method in class java.security.Signer Returns this signer's private key. getProcedureColumns(String, String, String, String). Method in interface java.sql.DatabaseMetaData Get a description of a catalog's stored procedure parameters and result columns. getProcedures(String, String, String). Method in interface java.sql.DatabaseMetaData Get a description of stored procedures available in a catalog. getProcedureTerm(). Method in interface java.sql.DatabaseMetaData What's the database vendor's preferred term for "procedure"? getPropagationId(). Method in class java.beans.PropertyChangeEvent The "propagationId" field is reserved for future use. getProperties(). Static method in class java.lang.System Determines the current system properties. getProperty(String). Method in class java.util.Properties Searches for the property with the specified key in this property list. getProperty(String). Static method in class java.security.Security Gets a security property. getProperty(String). Static method in class java.lang.System Gets the system property indicated by the specified key. getProperty(String, ImageObserver). Method in class java.awt.Image Gets a property of the image by name. getProperty(String, String). Method in class java.util.Properties Searches for the property with the specified key in this property list. getProperty(String, String). Static method in class java.lang.System Gets the system property indicated by the specified key. getProperty(String, String). Static method in class java.awt.Toolkit Gets a property with the specified key and default. getPropertyChangeEvent(). Method in class java.beans.PropertyVetoException getPropertyDescriptors(). Method in interface java.beans.BeanInfo getPropertyDescriptors(). Method in class java.beans.SimpleBeanInfo Deny knowledge of properties. getPropertyEditorClass(). Method in class java.beans.PropertyDescriptor getPropertyInfo(String, Properties). Method in interface java.sql.Driver

ww w. ja

The getPropertyInfo method is intended to allow a generic GUI tool to discover what properties it should prompt a human for in order to get enough information to connect to a database. getPropertyName(). Method in class java.beans.PropertyChangeEvent getPropertyType(). Method in class java.beans.PropertyDescriptor getProtocol(). Method in class java.net.URL Returns the protocol name this URL. getProvider(String). Static method in class java.security.Security Returns the provider installed with the specified name, if any. getProviders(). Static method in class java.security.Security Returns all providers currently installed. getPublic(). Method in class java.security.KeyPair Returns the public key from this key pair. getPublicKey(). Method in interface java.security.Certificate Returns the key of the principal-key pair being guaranteed by the guarantor. getPublicKey(). Method in class java.security.Identity Returns this identity's public key. getQ(). Method in interface java.security.interfaces.DSAParams Returns the subprime, q. getQueryTimeout(). Method in interface java.sql.Statement The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute. getRawOffset(). Method in class java.util.SimpleTimeZone Overrides TimeZone Gets the GMT offset for this time zone. getRawOffset(). Method in class java.util.TimeZone Gets unmodified offset, NOT modified in case of daylight savings. getRead(). Method in class java.sql.DataTruncation Was this a read truncation? getReadMethod(). Method in class java.beans.PropertyDescriptor getRed(). Method in class java.awt.Color Gets the red component. getRed(int). Method in class java.awt.image.ColorModel The subclass must provide a function which provides the red color compoment for the specified pixel. getRed(int). Method in class java.awt.image.DirectColorModel Returns the red color compoment for the specified pixel in the range 0-255. getRed(int). Method in class java.awt.image.IndexColorModel Returns the red color compoment for the specified pixel in the range 0-255. getRedMask(). Method in class java.awt.image.DirectColorModel Returns the mask indicating which bits in a pixel contain the red color component.

va
347

dil

i.c o

m

348
getReds(byte[]). Method in class java.awt.image.IndexColorModel Copies the array of red color components into the given array. getRef(). Method in class java.net.URL Returns the anchor (also known as the "reference") of this URL. getRefClass(ObjectOutput). Method in interface java.rmi.server.RemoteRef Returns the class name of the ref type to be serialized onto the stream 'out'. getRegistry(). Static method in class java.rmi.registry.LocateRegistry Returns the remote object Registry for the local host. getRegistry(int). Static method in class java.rmi.registry.LocateRegistry Returns the remote object Registry on the current host at the specified port. getRegistry(String). Static method in class java.rmi.registry.LocateRegistry Returns the remote object Registry on the specified host at a default (i.e., well-known) port number. getRegistry(String, int). Static method in class java.rmi.registry.LocateRegistry Returns the remote object Registry on the specified host at the specified port. getRemaining(). Method in class java.util.zip.Inflater Returns the total number of bytes remaining in the input buffer. getRemoteClass(). Method in class sun.tools.debug.RemoteStackFrame Get the class this stackframe references. getRemoveListenerMethod(). Method in class java.beans.EventSetDescriptor getRepresentationClass(). Method in class java.awt.datatransfer.DataFlavor Returns the Class which objects supporting this DataFlavor will return when this DataFlavor is requested. getRequestMethod(). Method in class java.net.HttpURLConnection Get the request method. getRequestProperty(String). Method in class java.net.URLConnection Returns the value of the named general request property for this connection. getResource(String). Method in class java.lang.Class getResource(String). Method in class java.lang.ClassLoader Find a resource with a given name. getResourceAsStream(String). Method in class java.lang.Class Find a resource with a given name. getResourceAsStream(String). Method in class java.lang.ClassLoader Get an InputStream on a given resource. getResponseCode(). Method in class java.net.HttpURLConnection Gets HTTP response status. getResponseMessage(). Method in class java.net.HttpURLConnection Gets the HTTP response message, if any, returned along with the response code from a server. getResultSet(). Method in interface java.sql.Statement getResultSet returns the current result as a ResultSet. getResultStream(boolean). Method in interface java.rmi.server.RemoteCall Returns an output stream (may put out header information relating to the success of the call). getReturnType(). Method in class java.lang.reflect.Method Returns a Class object that represents the formal return type of the method represented by this Method object. getRGB(). Method in class java.awt.Color Gets the RGB value representing the color in the default RGB ColorModel. getRGB(). Method in class java.awt.SystemColor Gets the "current" RGB value representing the symbolic color. getRGB(int). Method in class java.awt.image.ColorModel Returns the color of the pixel in the default RGB color model. getRGB(int). Method in class java.awt.image.DirectColorModel Returns the color of the pixel in the default RGB color model. getRGB(int). Method in class java.awt.image.IndexColorModel Returns the color of the pixel in the default RGB color model. getRGBdefault(). Static method in class java.awt.image.ColorModel Return a ColorModel which describes the default format for integer RGB values used throughout the AWT image interfaces. getRows(). Method in class java.awt.GridLayout Returns the number of rows in this layout. getRows(). Method in class java.awt.List Returns the number of visible lines in this list. getRows(). Method in class java.awt.TextArea Returns the number of rows in the TextArea. getRules(). Method in class java.text.RuleBasedCollator Gets the table-based rules for the collation object. getRuntime(). Static method in class java.lang.Runtime Returns the runtime object associated with the current Java application. getScale(int). Method in interface java.sql.ResultSetMetaData What's a column's number of digits to right of the decimal point? getScaledInstance(int, int, int). Method in class java.awt.Image Returns a scaled version of this image. getSchemaName(int). Method in interface java.sql.ResultSetMetaData What's a column's table's schema? getSchemas(). Method in interface java.sql.DatabaseMetaData Get the schema names available in this database. getSchemaTerm(). Method in interface java.sql.DatabaseMetaData What's the database vendor's preferred term for "schema"? getScope(). Method in class java.security.Identity Returns this identity's scope.

ww w. ja

va
348

dil

i.c o

m

349
getScreenResolution(). Method in class java.awt.Toolkit Returns the screen resolution in dots-per-inch. getScreenSize(). Method in class java.awt.Toolkit Gets the size of the screen. getScrollbarDisplayPolicy(). Method in class java.awt.ScrollPane Returns the display policy for the scrollbars. getScrollbarVisibility(). Method in class java.awt.TextArea Returns the enumerated value describing which scrollbars the text area has. getScrollPosition(). Method in class java.awt.ScrollPane Returns the current x,y position within the child which is displayed at the 0,0 location of the scrolled panel's view port. getSearchStringEscape(). Method in interface java.sql.DatabaseMetaData This is the string that can be used to escape '_' or '%' in the string pattern style catalog search parameters. getSeconds(). Method in class java.sql.Date Returns the number of seconds past the minute represented by this date. getSeconds(). Method in class java.util.Date Returns the number of seconds past the minute represented by this date. getSecurityContext(). Method in class java.rmi.RMISecurityManager Returns the security context (e.g., a URL). getSecurityContext(). Method in class java.lang.SecurityManager Creates an object that encapsulates the current execution environment. getSecurityContext(ClassLoader). Method in interface java.rmi.server.LoaderHandler Returns the security context of the given class loader (e.g., a URL) getSecurityContext(ClassLoader). Static method in class java.rmi.server.RMIClassLoader Returns the security context of the given class loader getSecurityManager(). Static method in class java.lang.System Gets the system security interface. getSeed(int). Static method in class java.security.SecureRandom Returns the given number of seed bytes, computed using the seed generation algorithm that this class uses to seed itself. getSelectedCheckbox(). Method in class java.awt.CheckboxGroup Gets the current choice. getSelectedIndex(). Method in class java.awt.Choice Returns the index of the currently selected item. getSelectedIndex(). Method in class java.awt.List Get the selected item on the list or -1 if no item is selected. getSelectedIndexes(). Method in class java.awt.List Returns the selected indexes on the list. getSelectedIndexes(). Method in interface java.awt.peer.ListPeer getSelectedItem(). Method in class java.awt.Choice Returns a String representation of the current choice. getSelectedItem(). Method in class java.awt.List Returns the selected item on the list or null if no item is selected. getSelectedItems(). Method in class java.awt.List Returns the selected items on the list in an array of Strings. getSelectedObjects(). Method in class java.awt.Checkbox Returns the an array (length 1) containing the checkbox label or null if the checkbox is not selected. getSelectedObjects(). Method in class java.awt.CheckboxMenuItem Returns the an array (length 1) containing the checkbox menu item label or null if the checkbox is not selected. getSelectedObjects(). Method in class java.awt.Choice Returns an array (length 1) containing the currently selected item. getSelectedObjects(). Method in interface java.awt.ItemSelectable Returns the selected items or null if no items are selected. getSelectedObjects(). Method in class java.awt.List Returns the selected items on the list in an array of Objects. getSelectedText(). Method in class java.awt.TextComponent Returns the selected text contained in this TextComponent. getSelectionEnd(). Method in class java.awt.TextComponent Returns the selected text's end position. getSelectionEnd(). Method in interface java.awt.peer.TextComponentPeer getSelectionStart(). Method in class java.awt.TextComponent Returns the selected text's start position. getSelectionStart(). Method in interface java.awt.peer.TextComponentPeer getSentenceInstance(). Static method in class java.text.BreakIterator Create BreakIterator for sentence-breaks using default locale Returns an instance of a BreakIterator implementing sentence breaks. getSentenceInstance(Locale). Static method in class java.text.BreakIterator Create BreakIterator for sentence-breaks using specified locale Returns an instance of a BreakIterator implementing sentence breaks. getSerialVersionUID(). Method in class java.io.ObjectStreamClass Return the serialVersionUID for this class. getShort(int). Method in interface java.sql.CallableStatement Get the value of a SMALLINT parameter as a Java short. getShort(int). Method in interface java.sql.ResultSet Get the value of a column in the current row as a Java short. getShort(Object). Method in class java.lang.reflect.Field Get the value of a field as a short on specified object. getShort(Object, int). Static method in class java.lang.reflect.Array

ww w. ja

va
349

dil

i.c o

m

350
Returns the value of the indexed component in the specified array object, as a short. getShort(String). Method in interface java.sql.ResultSet Get the value of a column in the current row as a Java short. getShortcut(). Method in class java.awt.MenuItem Return the MenuShortcut associated with this MenuItem, or null if none has been specified. getShortcutMenuItem(MenuShortcut). Method in class java.awt.MenuBar Return the MenuItem associated with a MenuShortcut, or null if none has been specified. getShortDescription(). Method in class java.beans.FeatureDescriptor getShortMonths(). Method in class java.text.DateFormatSymbols Gets short month strings. getShortWeekdays(). Method in class java.text.DateFormatSymbols Gets short weekday strings. getSigners(). Method in class java.lang.Class Get the signers of this class. getSize(). Method in class java.awt.Component Returns the current size of this component. getSize(). Method in class java.awt.Dimension Returns the size of this Dimension object. getSize(). Method in class java.awt.Font Gets the point size of the font. getSize(). Method in class java.awt.Rectangle Returns the size (width by height) of this rectangle. getSize(). Method in class sun.tools.debug.RemoteArray Return the number of elements in the array. getSize(). Method in class java.util.zip.ZipEntry Returns the uncompressed size of the entry data, or -1 if not known. getSocketFactory(). Static method in class java.rmi.server.RMISocketFactory Returns the socket factory used by RMI. getSoLinger(). Method in class java.net.Socket Returns setting for SO_LINGER. getSoTimeout(). Method in class java.net.DatagramSocket Retrive setting for SO_TIMEOUT. getSoTimeout(). Method in class java.net.ServerSocket Retrive setting for SO_TIMEOUT. getSoTimeout(). Method in class java.net.Socket Returns setting for SO_TIMEOUT. getSource(). Method in class java.util.EventObject getSource(). Method in class java.awt.Image Gets the object that produces the pixels for the image. getSourceFile(). Method in class sun.tools.debug.RemoteClass Get the source file referenced by this stackframe. getSourceFileName(). Method in class sun.tools.debug.RemoteClass Get the name of the source file referenced by this stackframe. getSourcePath(). Method in class sun.tools.debug.RemoteDebugger Return the source file path the Agent is currently using. getSourceString(). Method in class java.text.CollationKey Returns the String that this CollationKey represents. getSQLKeywords(). Method in interface java.sql.DatabaseMetaData Get a comma separated list of all a database's SQL keywords that are NOT also SQL92 keywords. getSQLState(). Method in class java.sql.SQLException Get the SQLState getStackVariable(String). Method in class sun.tools.debug.RemoteThread Return a stack variable from the current stackframe. getStackVariables(). Method in class sun.tools.debug.RemoteThread Return the arguments and local variable from the current stackframe. getState(). Method in class java.awt.Checkbox Returns the boolean state of the Checkbox. getState(). Method in class java.awt.CheckboxMenuItem Returns the state of this MenuItem. getStateChange(). Method in class java.awt.event.ItemEvent Returns the state change type which generated the event. getStaticFields(). Method in class sun.tools.debug.RemoteClass Return all the static fields for this class. getStatus(). Method in class java.awt.image.PixelGrabber Return the status of the pixels. getStatus(). Method in class sun.tools.debug.RemoteThread Return the thread status description getStrength(). Method in class java.text.Collator Returns this Collator's strength property. getString(int). Method in interface java.sql.CallableStatement Get the value of a CHAR, VARCHAR, or LONGVARCHAR parameter as a Java String. getString(int). Method in interface java.sql.ResultSet Get the value of a column in the current row as a Java String. getString(String). Method in class java.util.ResourceBundle Get an object from a ResourceBundle. getString(String). Method in interface java.sql.ResultSet

ww w. ja

va
350

dil

i.c o

m

351
Get the value of a column in the current row as a Java String. getStringArray(String). Method in class java.util.ResourceBundle Get an object from a ResourceBundle. getStringFunctions(). Method in interface java.sql.DatabaseMetaData Get a comma separated list of string functions. getStyle(). Method in class java.awt.Font Gets the style of the font. getSuperclass(). Method in class java.lang.Class If this object represents any class other than the class Object, then the object that represents the superclass of that class is returned. getSuperclass(). Method in class sun.tools.debug.RemoteClass Return the superclass for this class. getSystemClipboard(). Method in class java.awt.Toolkit Returns an instance of the "system" clipboard which interfaces with the clipboard facilities on the native platform. getSystemEventQueue(). Method in class java.awt.Toolkit Get the application's or applet's EventQueue instance. getSystemEventQueueImpl(). Method in class java.awt.Toolkit getSystemFunctions(). Method in interface java.sql.DatabaseMetaData Get a comma separated list of system functions. getSystemResource(String). Static method in class java.lang.ClassLoader Find a resource with a given name. getSystemResourceAsStream(String). Static method in class java.lang.ClassLoader Get an InputStream on a given resource.. getSystemScope(). Static method in class java.security.IdentityScope Returns the system's identity scope. getTableName(int). Method in interface java.sql.ResultSetMetaData What's a column's table name? getTablePrivileges(String, String, String). Method in interface java.sql.DatabaseMetaData Get a description of the access rights for each table available in a catalog. getTables(String, String, String, String[]). Method in interface java.sql.DatabaseMetaData Get a description of tables available in a catalog. getTableTypes(). Method in interface java.sql.DatabaseMetaData Get the table types available in this database. getTags(). Method in interface java.beans.PropertyEditor If the property value must be one of a set of known tagged values, then this method should return an array of the tags. getTags(). Method in class java.beans.PropertyEditorSupport If the property value must be one of a set of known tagged values, then this method should return an array of the tag values. getTargetException(). Method in class java.lang.reflect.InvocationTargetException Get the thrown target exception. getTcpNoDelay(). Method in class java.net.Socket Tests if TCP_NODELAY is enabled. getText(). Method in class java.text.BreakIterator Get the text being scanned getText(). Method in class java.awt.Label Gets the text of this label. getText(). Method in class java.awt.TextComponent Returns the text contained in this TextComponent. getText(). Method in interface java.awt.peer.TextComponentPeer getThreadGroup(). Method in class java.lang.SecurityManager Returns the thread group into which to instantiate any new thread being created at the time this is being called. getThreadGroup(). Method in class java.lang.Thread Returns this thread's thread group. getTime(). Method in class java.util.Calendar Gets this Calendar's current time. getTime(). Method in class java.util.Date Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this date. getTime(). Method in class java.util.zip.ZipEntry Returns the modification time of the entry, or -1 if not specified. getTime(int). Method in interface java.sql.CallableStatement Get the value of a SQL TIME parameter as a java.sql.Time object. getTime(int). Method in interface java.sql.ResultSet Get the value of a column in the current row as a java.sql.Time object. getTime(String). Method in interface java.sql.ResultSet Get the value of a column in the current row as a java.sql.Time object. getTimeDateFunctions(). Method in interface java.sql.DatabaseMetaData Get a comma separated list of time and date functions. getTimeInMillis(). Method in class java.util.Calendar Gets this Calendar's current time as a long. getTimeInstance(). Static method in class java.text.DateFormat Gets the time formatter with the default formatting style for the default locale. getTimeInstance(int). Static method in class java.text.DateFormat Gets the time formatter with the given formatting style for the default locale. getTimeInstance(int, Locale). Static method in class java.text.DateFormat Gets the time formatter with the given formatting style for the given locale. getTimestamp(int). Method in interface java.sql.CallableStatement Get the value of a SQL TIMESTAMP parameter as a java.sql.Timestamp object.

ww w. ja

va
351

dil

i.c o

m

352
getTimestamp(int). Method in interface java.sql.ResultSet Get the value of a column in the current row as a java.sql.Timestamp object. getTimestamp(String). Method in interface java.sql.ResultSet Get the value of a column in the current row as a java.sql.Timestamp object. getTimeZone(). Method in class java.util.Calendar Gets the time zone. getTimeZone(). Method in class java.text.DateFormat Gets the time zone. getTimeZone(String). Static method in class java.util.TimeZone Gets the TimeZone for the given ID. getTimezoneOffset(). Method in class java.util.Date Returns the local time-zone offset. getTitle(). Method in class java.awt.Dialog Gets the title of the Dialog. getTitle(). Method in class java.awt.Frame Gets the title of the Frame. getToolkit(). Method in class java.awt.Component Gets the toolkit of the component. getToolkit(). Method in interface java.awt.peer.ComponentPeer getToolkit(). Method in class java.awt.Window Returns the toolkit of this frame. getTotalIn(). Method in class java.util.zip.Deflater Returns the total number of bytes input so far. getTotalIn(). Method in class java.util.zip.Inflater Returns the total number of bytes input so far. getTotalOut(). Method in class java.util.zip.Deflater Returns the total number of bytes output so far. getTotalOut(). Method in class java.util.zip.Inflater Returns the total number of bytes output so far. getTransactionIsolation(). Method in interface java.sql.Connection Get this Connection's current transaction isolation mode. getTransferData(DataFlavor). Method in class java.awt.datatransfer.StringSelection If the data was requested in the "java.lang.String" flavor, return the String representing the selection. getTransferData(DataFlavor). Method in interface java.awt.datatransfer.Transferable Returns an object which represents the data to be transferred. getTransferDataFlavors(). Method in class java.awt.datatransfer.StringSelection Returns the array of flavors in which it can provide the data. getTransferDataFlavors(). Method in interface java.awt.datatransfer.Transferable Returns an array of DataFlavor objects indicating the flavors the data can be provided in. getTransferSize(). Method in class java.sql.DataTruncation Get the number of bytes of data actually transferred. getTransparentPixel(). Method in class java.awt.image.IndexColorModel Returns the index of the transparent pixel in this IndexColorModel or -1 if there is no transparent pixel. getTreeLock(). Method in class java.awt.Component Gets the locking object for AWT component-tree and layout operations. getTTL(). Method in class java.net.DatagramSocketImpl Retrieve the TTL (time-to-live) option. getTTL(). Method in class java.net.MulticastSocket Get the default time-to-live for multicast packets sent out on the socket. getType(). Method in class java.awt.Cursor Returns the type for this cursor. getType(). Method in class java.lang.reflect.Field Returns a Class object that identifies the declared type for the field represented by this Field object. getType(). Method in class sun.tools.debug.RemoteField Returns a Type object for the field. getType(). Method in class sun.tools.debug.RemoteStackVariable Returns a Type object for the field. getType(). Method in class sun.tools.debug.RemoteValue Returns the RemoteValue's type. getType(char). Static method in class java.lang.Character Returns a value indicating a character category. getTypedName(). Method in class sun.tools.debug.RemoteField Returns a string describing the field with its full type. getTypeInfo(). Method in interface java.sql.DatabaseMetaData Get a description of all the standard SQL types supported by this database. getUnicodeStream(int). Method in interface java.sql.ResultSet A column value can be retrieved as a stream of Unicode characters and then read in chunks from the stream. getUnicodeStream(String). Method in interface java.sql.ResultSet A column value can be retrieved as a stream of Unicode characters and then read in chunks from the stream. getUnitIncrement(). Method in interface java.awt.Adjustable Gets the unit value increment for the adjustable object. getUnitIncrement(). Method in class java.awt.Scrollbar Gets the unit increment for this scrollbar. getUpdateCount(). Method in interface java.sql.Statement getUpdateCount returns the current result as an update count; if the result is a ResultSet or there are no more results, -1 is returned.

ww w. ja

va
352

dil

i.c o

m

353
getUpdateRect(). Method in class java.awt.event.PaintEvent Returns the rectangle representing the area which needs to be repainted in response to this event. getURL(). Method in interface java.sql.DatabaseMetaData What's the url for this database? getURL(). Method in class java.net.URLConnection Returns the value of this URLConnection's URL field. getUseCaches(). Method in class java.net.URLConnection Returns the value of this URLConnection's useCaches field. getUserName(). Method in interface java.sql.DatabaseMetaData What's our user name as known to the database? getVAdjustable(). Method in class java.awt.ScrollPane Returns the Adjustable object which represents the state of the vertical scrollbar. getValue(). Method in interface java.awt.Adjustable Gets the current value of the adjustable object. getValue(). Method in class java.awt.event.AdjustmentEvent Returns the current value in the adjustment event. getValue(). Method in class java.util.zip.Adler32 Returns checksum value. getValue(). Method in interface java.util.zip.Checksum Returns the current checksum value. getValue(). Method in class java.util.zip.CRC32 Returns CRC-32 value. getValue(). Method in class java.rmi.dgc.Lease Returns the lease duration. getValue(). Method in interface java.beans.PropertyEditor getValue(). Method in class java.beans.PropertyEditorSupport getValue(). Method in class sun.tools.debug.RemoteStackVariable Return the value of a stack variable or argument. getValue(). Method in class java.awt.Scrollbar Returns the current value of this Scrollbar. getValue(String). Method in class java.beans.FeatureDescriptor Retrieve a named attribute with this feature. getVariant(). Method in class java.util.Locale Getter for programmatic name of field. getVersion(). Method in class java.security.Provider Returns the version number for this provider. getVersionColumns(String, String, String). Method in interface java.sql.DatabaseMetaData Get a description of a table's columns that are automatically updated when any value in a row is updated. getVgap(). Method in class java.awt.BorderLayout Returns the vertical gap between components. getVgap(). Method in class java.awt.CardLayout Returns the vertical gap between components. getVgap(). Method in class java.awt.FlowLayout Returns the vertical gap between components. getVgap(). Method in class java.awt.GridLayout Returns the vertical gap between components. getViewportSize(). Method in class java.awt.ScrollPane Returns the current size of the scroll pane's view port. getVisible(). Method in class java.awt.Scrollbar getVisibleAmount(). Method in interface java.awt.Adjustable Gets the length of the propertional indicator. getVisibleAmount(). Method in class java.awt.Scrollbar Returns the visible amount of this Scrollbar. getVisibleIndex(). Method in class java.awt.List Gets the index of the item that was last made visible by the method makeVisible. getVMID(). Method in class java.rmi.dgc.Lease Returns the client VMID associated with the lease. getVScrollbarWidth(). Method in class java.awt.ScrollPane Returns the width that would be occupied by a vertical scrollbar, which is independent of whether it is currently displayed by the scroll pane or not. getVScrollbarWidth(). Method in interface java.awt.peer.ScrollPanePeer getWarnings(). Method in interface java.sql.Connection The first warning reported by calls on this Connection is returned. getWarnings(). Method in interface java.sql.ResultSet The first warning reported by calls on this ResultSet is returned. getWarnings(). Method in interface java.sql.Statement The first warning reported by calls on this Statement is returned. getWarningString(). Method in class java.awt.Window Gets the warning string for this window. getWeekdays(). Method in class java.text.DateFormatSymbols Gets weekday strings. getWhen(). Method in class java.awt.event.InputEvent Returns the timestamp of when this event occurred. getWidth(). Method in class java.awt.image.PixelGrabber Get the width of the pixel buffer (after adjusting for image width).

ww w. ja

va
353

dil

i.c o

m

354
getWidth(ImageObserver). Method in class java.awt.Image Gets the actual width of the image. getWidths(). Method in class java.awt.FontMetrics Gets the advance widths of the first 256 characters in the Font. getWindow(). Method in class java.awt.event.WindowEvent Returns the window where this event originated. getWordInstance(). Static method in class java.text.BreakIterator Create BreakIterator for word-breaks using default locale. getWordInstance(Locale). Static method in class java.text.BreakIterator Create BreakIterator for word-breaks using default locale. getWriteMethod(). Method in class java.beans.PropertyDescriptor getX(). Method in interface java.security.interfaces.DSAPrivateKey Returns the value of the private key, x. getX(). Method in class java.awt.event.MouseEvent Returns the x position of the event relative to the source component. getY(). Method in interface java.security.interfaces.DSAPublicKey Returns the value of the public key, y. getY(). Method in class java.awt.event.MouseEvent Returns the y position of the event relative to the source component. getYear(). Method in class java.util.Date Returns the year represented by this date, minus 1900. getYear(). Method in class java.sql.Time Returns the year represented by this date, minus 1900. getZeroDigit(). Method in class java.text.DecimalFormatSymbols character used for zero. getZoneStrings(). Method in class java.text.DateFormatSymbols Gets timezone strings. GOT_FOCUS. Static variable in class java.awt.Event A component gained the focus. gotFocus(Event, Object). Method in class java.awt.Component grabPixels(). Method in class java.awt.image.PixelGrabber Request the Image or ImageProducer to start delivering pixels and wait for all of the pixels in the rectangle of interest to be delivered. grabPixels(long). Method in class java.awt.image.PixelGrabber Request the Image or ImageProducer to start delivering pixels and wait for all of the pixels in the rectangle of interest to be delivered or until the specified timeout has elapsed. Graphics(). Constructor for class java.awt.Graphics Constructs a new Graphics object. gray. Static variable in class java.awt.Color The color gray. green. Static variable in class java.awt.Color The color green. GregorianCalendar(). Constructor for class java.util.GregorianCalendar Constructs a default GregorianCalendar using the current time in the default time zone with the default locale. GregorianCalendar(int, int, int). Constructor for class java.util.GregorianCalendar Constructs a GregorianCalendar with the given date set in the default time zone with the default locale. GregorianCalendar(int, int, int, int, int). Constructor for class java.util.GregorianCalendar Constructs a GregorianCalendar with the given date and time set for the default time zone with the default locale. GregorianCalendar(int, int, int, int, int, int). Constructor for class java.util.GregorianCalendar Constructs a GregorianCalendar with the given date and time set for the default time zone with the default locale. GregorianCalendar(Locale). Constructor for class java.util.GregorianCalendar Constructs a GregorianCalendar based on the current time in the default time zone with the given locale. GregorianCalendar(TimeZone). Constructor for class java.util.GregorianCalendar Constructs a GregorianCalendar based on the current time in the given time zone with the default locale. GregorianCalendar(TimeZone, Locale). Constructor for class java.util.GregorianCalendar Constructs a GregorianCalendar based on the current time in the given time zone with the given locale. GridBagConstraints(). Constructor for class java.awt.GridBagConstraints GridBagLayout(). Constructor for class java.awt.GridBagLayout Creates a gridbag layout. gridheight. Variable in class java.awt.GridBagConstraints GridLayout(). Constructor for class java.awt.GridLayout Creates a grid layout with a default of one column per component, in a single row. GridLayout(int, int). Constructor for class java.awt.GridLayout Creates a grid layout with the specified rows and columns. GridLayout(int, int, int, int). Constructor for class java.awt.GridLayout Creates a grid layout with the specified rows, columns, horizontal gap, and vertical gap. gridwidth. Variable in class java.awt.GridBagConstraints gridx. Variable in class java.awt.GridBagConstraints gridy. Variable in class java.awt.GridBagConstraints grow(int, int). Method in class java.awt.Rectangle Grows the rectangle horizontally and vertically. guessContentTypeFromName(String). Static method in class java.net.URLConnection Tries to determine the content type of an object, based on the specified "file" component of a URL. guessContentTypeFromStream(InputStream). Static method in class java.net.URLConnection Tries to determine the type of an input stream based on the characters at the beginning of the input stream. GZIP_MAGIC. Static variable in class java.util.zip.GZIPInputStream

ww w. ja

va
354

dil

i.c o

m

355
GZIP header magic number. GZIPInputStream(InputStream). Constructor for class java.util.zip.GZIPInputStream Creates a new input stream with a default buffer size. GZIPInputStream(InputStream, int). Constructor for class java.util.zip.GZIPInputStream Creates a new input stream with the specified buffer size. GZIPOutputStream(OutputStream). Constructor for class java.util.zip.GZIPOutputStream Creates a new output stream with a default buffer size. GZIPOutputStream(OutputStream, int). Constructor for class java.util.zip.GZIPOutputStream Creates a new output stream with the specified buffer size.

H

ww w. ja

HAND_CURSOR. Static variable in class java.awt.Cursor The hand cursor type. HAND_CURSOR. Static variable in class java.awt.Frame handleEvent(AWTEvent). Method in interface java.awt.peer.ComponentPeer handleEvent(Event). Method in class java.awt.Component handleGetObject(String). Method in class java.util.ListResourceBundle Override of ResourceBundle, same semantics handleGetObject(String). Method in class java.util.PropertyResourceBundle Override of ResourceBundle, same semantics handleGetObject(String). Method in class java.util.ResourceBundle Get an object from a ResourceBundle. hasChanged(). Method in class java.util.Observable Tests if this object has changed. hashCode(). Method in class java.math.BigDecimal Computes a hash code for this object. hashCode(). Method in class java.math.BigInteger Computes a hash code for this object. hashCode(). Method in class java.util.BitSet Returns a hash code value for this bit set. hashCode(). Method in class java.lang.Boolean Returns a hash code for this Boolean. hashCode(). Method in class java.lang.Byte Returns a hashcode for this Byte. hashCode(). Method in class java.lang.Character Returns a hash code for this Character. hashCode(). Method in class java.text.ChoiceFormat Generates a hash code for the message format object. hashCode(). Method in class java.text.CollationKey Creates a hash code for this CollationKey. hashCode(). Method in class java.text.Collator Generates the hash code for this Collator. hashCode(). Method in class java.awt.Color Computes the hash code. hashCode(). Method in class java.lang.reflect.Constructor Returns a hashcode for this Constructor. hashCode(). Method in class java.util.Date Returns a hash code value for this object. hashCode(). Method in class java.text.DateFormat Overrides hashCode hashCode(). Method in class java.text.DateFormatSymbols Override hashCode. hashCode(). Method in class java.text.DecimalFormat Overrides hashCode hashCode(). Method in class java.text.DecimalFormatSymbols Override hashCode hashCode(). Method in class java.lang.Double Returns a hashcode for this Double. hashCode(). Method in class java.lang.reflect.Field Returns a hashcode for this Field. hashCode(). Method in class java.io.File Computes a hashcode for the file. hashCode(). Method in class java.lang.Float Returns a hashcode for this Float. hashCode(). Method in class java.awt.Font Returns a hashcode for this font. hashCode(). Method in class java.util.GregorianCalendar Override hashCode. hashCode(). Method in class java.security.Identity Returns a hashcode for this identity. hashCode(). Method in class java.net.InetAddress Returns a hashcode for this IP address. hashCode(). Method in class java.lang.Integer

va
355

dil

i.c o

m

356
Returns a hashcode for this Integer. hashCode(). Method in class java.util.Locale Override hashCode. hashCode(). Method in class java.lang.Long Computes a hashcode for this Long. hashCode(). Method in class java.text.MessageFormat Generates a hash code for the message format object. hashCode(). Method in class java.lang.reflect.Method Returns a hashcode for this Method. hashCode(). Method in class java.text.NumberFormat Overrides hashCode hashCode(). Method in class java.lang.Object Returns a hash code value for the object. hashCode(). Method in class java.rmi.server.ObjID The hashcode is the object number. hashCode(). Method in class java.awt.Point Returns the hashcode for this Point. hashCode(). Method in interface java.security.Principal Returns a hashcode for this principal. hashCode(). Method in class java.awt.Rectangle Returns the hashcode for this Rectangle. hashCode(). Method in class java.rmi.server.RemoteObject Returns a hashcode for a remote object. hashCode(). Method in class java.text.RuleBasedCollator Generates the hash code for the table-based collation object hashCode(). Method in class java.lang.Short Returns a hashcode for this Short. hashCode(). Method in class java.text.SimpleDateFormat Override hashCode. hashCode(). Method in class java.util.SimpleTimeZone Override hashCode. hashCode(). Method in class java.lang.String Returns a hashcode for this string. hashCode(). Method in class java.text.StringCharacterIterator Compute a hashcode for this enumeration hashCode(). Method in class java.rmi.server.UID Returns a hash code value for the object. hashCode(). Method in class java.net.URL Creates an integer suitable for hash table indexing. hashCode(). Method in class java.rmi.dgc.VMID Compute hash code for this VMID. Hashtable(). Constructor for class java.util.Hashtable Constructs a new, empty hashtable with a default capacity and load factor. Hashtable(int). Constructor for class java.util.Hashtable Constructs a new, empty hashtable with the specified initial capacity and default load factor. Hashtable(int, float). Constructor for class java.util.Hashtable Constructs a new, empty hashtable with the specified initial capacity and the specified load factor. hasMoreElements(). Method in interface java.util.Enumeration Tests if this enumeration contains more elements. hasMoreElements(). Method in class java.util.StringTokenizer Returns the same value as the hasMoreTokens method. hasMoreTokens(). Method in class java.util.StringTokenizer Tests if there are more tokens available from this tokenizer's string. height. Variable in class java.awt.Dimension The height dimension. HEIGHT. Static variable in interface java.awt.image.ImageObserver The height of the base image is now available and can be taken from the height argument to the imageUpdate callback method. height. Variable in class java.awt.Rectangle The height of the rectangle. hide(). Method in class java.awt.Component hide(). Method in interface java.awt.peer.ComponentPeer DEPRECATED: Replaced by setVisible(boolean). HOME. Static variable in class java.awt.Event The home action-key. HORIZONTAL. Static variable in interface java.awt.Adjustable The horizontal orientation. HORIZONTAL. Static variable in class java.awt.GridBagConstraints HORIZONTAL. Static variable in class java.awt.Scrollbar The horizontal Scrollbar variable. HOUR. Static variable in class java.util.Calendar Useful constant for date and time. HOUR0_FIELD. Static variable in class java.text.DateFormat Useful constant for zero-based HOUR field alignment. HOUR1_FIELD. Static variable in class java.text.DateFormat Useful constant for one-based HOUR field alignment.

ww w. ja

va
356

dil

i.c o

m

357
HOUR_OF_DAY. Static variable in class java.util.Calendar Useful constant for date and time. HOUR_OF_DAY0_FIELD. Static variable in class java.text.DateFormat Useful constant for zero-based HOUR_OF_DAY field alignment. HOUR_OF_DAY1_FIELD. Static variable in class java.text.DateFormat Useful constant for one-based HOUR_OF_DAY field alignment. HSBtoRGB(float, float, float). Static method in class java.awt.Color Returns the RGB value defined by the default RGB ColorModel, of the color corresponding to the given HSB color components. HTTP_ACCEPTED. Static variable in class java.net.HttpURLConnection HTTP_BAD_GATEWAY. Static variable in class java.net.HttpURLConnection HTTP_BAD_METHOD. Static variable in class java.net.HttpURLConnection HTTP_BAD_REQUEST. Static variable in class java.net.HttpURLConnection 4XX: client error HTTP_CLIENT_TIMEOUT. Static variable in class java.net.HttpURLConnection HTTP_CONFLICT. Static variable in class java.net.HttpURLConnection HTTP_CREATED. Static variable in class java.net.HttpURLConnection HTTP_ENTITY_TOO_LARGE. Static variable in class java.net.HttpURLConnection HTTP_FORBIDDEN. Static variable in class java.net.HttpURLConnection HTTP_GATEWAY_TIMEOUT. Static variable in class java.net.HttpURLConnection HTTP_GONE. Static variable in class java.net.HttpURLConnection HTTP_INTERNAL_ERROR. Static variable in class java.net.HttpURLConnection HTTP_LENGTH_REQUIRED. Static variable in class java.net.HttpURLConnection HTTP_MOVED_PERM. Static variable in class java.net.HttpURLConnection HTTP_MOVED_TEMP. Static variable in class java.net.HttpURLConnection HTTP_MULT_CHOICE. Static variable in class java.net.HttpURLConnection 3XX: relocation/redirect HTTP_NO_CONTENT. Static variable in class java.net.HttpURLConnection HTTP_NOT_ACCEPTABLE. Static variable in class java.net.HttpURLConnection HTTP_NOT_AUTHORITATIVE. Static variable in class java.net.HttpURLConnection HTTP_NOT_FOUND. Static variable in class java.net.HttpURLConnection HTTP_NOT_MODIFIED. Static variable in class java.net.HttpURLConnection HTTP_OK. Static variable in class java.net.HttpURLConnection 2XX: generally "OK" HTTP_PARTIAL. Static variable in class java.net.HttpURLConnection HTTP_PAYMENT_REQUIRED. Static variable in class java.net.HttpURLConnection HTTP_PRECON_FAILED. Static variable in class java.net.HttpURLConnection HTTP_PROXY_AUTH. Static variable in class java.net.HttpURLConnection HTTP_REQ_TOO_LONG. Static variable in class java.net.HttpURLConnection HTTP_RESET. Static variable in class java.net.HttpURLConnection HTTP_SEE_OTHER. Static variable in class java.net.HttpURLConnection HTTP_SERVER_ERROR. Static variable in class java.net.HttpURLConnection 5XX: server error HTTP_UNAUTHORIZED. Static variable in class java.net.HttpURLConnection HTTP_UNAVAILABLE. Static variable in class java.net.HttpURLConnection HTTP_UNSUPPORTED_TYPE. Static variable in class java.net.HttpURLConnection HTTP_USE_PROXY. Static variable in class java.net.HttpURLConnection HTTP_VERSION. Static variable in class java.net.HttpURLConnection HttpURLConnection(URL). Constructor for class java.net.HttpURLConnection Constructor for the URLStreamHandler. HUFFMAN_ONLY. Static variable in class java.util.zip.Deflater Compression strategy for Huffman coding only.

ww w. ja
I

ICON_COLOR_16x16. Static variable in interface java.beans.BeanInfo Constant to indicate a 16 x 16 color icon. ICON_COLOR_32x32. Static variable in interface java.beans.BeanInfo Constant to indicate a 32 x 32 color icon. ICON_MONO_16x16. Static variable in interface java.beans.BeanInfo Constant to indicate a 16 x 16 monochrome icon. ICON_MONO_32x32. Static variable in interface java.beans.BeanInfo Constant to indicate a 32 x 32 monochrome icon. id. Variable in class java.awt.AWTEvent id. Variable in class java.awt.Event The type of this event. IDENTICAL. Static variable in class java.text.Collator Collator strength value. identities(). Method in class java.security.IdentityScope Returns an enumeration of all identities in this identity scope. Identity(). Constructor for class java.security.Identity Constructor for serialization only. Identity(String). Constructor for class java.security.Identity Constructs an identity with the specified name and no scope.

va
357

dil

i.c o

m

358
Identity(String, IdentityScope). Constructor for class java.security.Identity Constructs an identity with the specified name and scope. identityEquals(Identity). Method in class java.security.Identity Tests for equality between the specified identity and this identity. identityHashCode(Object). Static method in class java.lang.System Returns the same hashcode for the given object as would be returned by the default method hashCode(), whether or not the given object's class overrides hashCode(). IdentityScope(). Constructor for class java.security.IdentityScope This constructor is used for serialization only and should not be used by subclasses. IdentityScope(String). Constructor for class java.security.IdentityScope Constructs a new identity scope with the specified name. IdentityScope(String, IdentityScope). Constructor for class java.security.IdentityScope Constructs a new identity scope with the specified name and scope. IEEEremainder(double, double). Static method in class java.lang.Math Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard. ifModifiedSince. Variable in class java.net.URLConnection Some protocols support skipping the fetching of the object unless the object has been modified more recently than a certain time. ignoreExceptions(). Method in class sun.tools.debug.RemoteClass Don't enter the debugger when an instance of this class is thrown. IllegalAccessError(). Constructor for class java.lang.IllegalAccessError Constructs an IllegalAccessError with no detail message. IllegalAccessError(String). Constructor for class java.lang.IllegalAccessError Constructs an IllegalAccessError with the specified detail message. IllegalAccessException(). Constructor for class java.lang.IllegalAccessException Constructs an IllegalAccessException without a detail message. IllegalAccessException(String). Constructor for class java.lang.IllegalAccessException Constructs an IllegalAccessException with a detail message. IllegalArgumentException(). Constructor for class java.lang.IllegalArgumentException Constructs an IllegalArgumentException with no detail message. IllegalArgumentException(String). Constructor for class java.lang.IllegalArgumentException Constructs an IllegalArgumentException with the specified detail message. IllegalComponentStateException(). Constructor for class java.awt.IllegalComponentStateException Constructs an IllegalComponentStateException with no detail message. IllegalComponentStateException(String). Constructor for class java.awt.IllegalComponentStateException Constructs an IllegalComponentStateException with the specified detail message. IllegalMonitorStateException(). Constructor for class java.lang.IllegalMonitorStateException Constructs an IllegalMonitorStateException with no detail message. IllegalMonitorStateException(String). Constructor for class java.lang.IllegalMonitorStateException Constructs an IllegalMonitorStateException with the specified detail message. IllegalStateException(). Constructor for class java.lang.IllegalStateException Constructs an IllegalStateException with no detail message. IllegalStateException(String). Constructor for class java.lang.IllegalStateException Constructs an IllegalStateException with the specified detail message. IllegalThreadStateException(). Constructor for class java.lang.IllegalThreadStateException Constructs an IllegalThreadStateException with no detail message. IllegalThreadStateException(String). Constructor for class java.lang.IllegalThreadStateException Constructs an IllegalThreadStateException with the specified detail message. Image(). Constructor for class java.awt.Image IMAGEABORTED. Static variable in interface java.awt.image.ImageConsumer The image creation process was deliberately aborted. imageComplete(int). Method in interface java.awt.image.ImageConsumer The imageComplete method is called when the ImageProducer is finished delivering all of the pixels that the source image contains, or when a single frame of a multi-frame animation has been completed, or when an error in loading or producing the image has occured. imageComplete(int). Method in class java.awt.image.ImageFilter Filters the information provided in the imageComplete method of the ImageConsumer interface. imageComplete(int). Method in class java.awt.image.PixelGrabber The imageComplete method is part of the ImageConsumer API which this class must implement to retrieve the pixels. IMAGEERROR. Static variable in interface java.awt.image.ImageConsumer An error was encountered while producing the image. ImageFilter(). Constructor for class java.awt.image.ImageFilter imageUpdate(Image, int, int, int, int, int). Method in class java.awt.Component Repaints the component when the image has changed. imageUpdate(Image, int, int, int, int, int). Method in interface java.awt.image.ImageObserver This method is called when information about an image which was previously requested using an asynchronous interface becomes available. implAccept(Socket). Method in class java.net.ServerSocket Subclasses of ServerSocket use this method to override accept() to return their own subclass of socket. importedKeyCascade. Static variable in interface java.sql.DatabaseMetaData IMPORT KEY UPDATE_RULE and DELETE_RULE - for update, change imported key to agree with primary key update; for delete, delete rows that import a deleted key. importedKeyInitiallyDeferred. Static variable in interface java.sql.DatabaseMetaData IMPORT KEY DEFERRABILITY - see SQL92 for definition importedKeyInitiallyImmediate. Static variable in interface java.sql.DatabaseMetaData IMPORT KEY DEFERRABILITY - see SQL92 for definition

ww w. ja

va
358

dil

i.c o

m

359
importedKeyNoAction. Static variable in interface java.sql.DatabaseMetaData IMPORT KEY UPDATE_RULE and DELETE_RULE - do not allow update or delete of primary key if it has been imported. importedKeyNotDeferrable. Static variable in interface java.sql.DatabaseMetaData IMPORT KEY DEFERRABILITY - see SQL92 for definition importedKeyRestrict. Static variable in interface java.sql.DatabaseMetaData IMPORT KEY UPDATE_RULE and DELETE_RULE - do not allow update or delete of primary key if it has been imported. importedKeySetDefault. Static variable in interface java.sql.DatabaseMetaData IMPORT KEY UPDATE_RULE and DELETE_RULE - change imported key to default values if its primary key has been updated or deleted. importedKeySetNull. Static variable in interface java.sql.DatabaseMetaData IMPORT KEY UPDATE_RULE and DELETE_RULE - change imported key to NULL if its primary key has been updated or deleted. in. Static variable in class java.io.FileDescriptor A handle to the standard input stream. in. Variable in class java.io.FilterInputStream The underlying input stream. in. Variable in class java.io.FilterReader The underlying character-input stream, or null if the stream has been closed in. Variable in class java.io.PipedInputStream in. Static variable in class java.lang.System The "standard" input stream. INACTIVE_CAPTION. Static variable in class java.awt.SystemColor The array index for the inactive caption background color. INACTIVE_CAPTION_BORDER. Static variable in class java.awt.SystemColor The array index for the inactive caption border color. INACTIVE_CAPTION_TEXT. Static variable in class java.awt.SystemColor The array index for the inactive caption text color. inactiveCaption. Static variable in class java.awt.SystemColor The background color for inactive captions in window borders. inactiveCaptionBorder. Static variable in class java.awt.SystemColor The border color for inactive captios in window borders. inactiveCaptionText. Static variable in class java.awt.SystemColor The text color for inactive captions in window borders. inCheck. Variable in class java.lang.SecurityManager This field is true if there is a security check in progress; false otherwise. inClass(String). Method in class java.lang.SecurityManager Tests if the specified String is in this Class. inClassLoader(). Method in class java.lang.SecurityManager Tests if the current ClassLoader is equal to null. IncompatibleClassChangeError(). Constructor for class java.lang.IncompatibleClassChangeError Constructs an IncompatibleClassChangeError with no detail message. IncompatibleClassChangeError(String). Constructor for class java.lang.IncompatibleClassChangeError Constructs an IncompatibleClassChangeError with the specified detail message. inDaylightTime(Date). Method in class java.util.SimpleTimeZone Overrides TimeZone Queries if the given date is in Daylight Savings Time. inDaylightTime(Date). Method in class java.util.TimeZone Queries if the given date is in Daylight Savings Time in this time zone. IndexColorModel(int, int, byte[], byte[], byte[]). Constructor for class java.awt.image.IndexColorModel Constructs an IndexColorModel from the given arrays of red, green, and blue components. IndexColorModel(int, int, byte[], byte[], byte[], byte[]). Constructor for class java.awt.image.IndexColorModel Constructs an IndexColorModel from the given arrays of red, green, blue and alpha components. IndexColorModel(int, int, byte[], byte[], byte[], int). Constructor for class java.awt.image.IndexColorModel Constructs an IndexColorModel from the given arrays of red, green, and blue components. IndexColorModel(int, int, byte[], int, boolean). Constructor for class java.awt.image.IndexColorModel Constructs an IndexColorModel from a single arrays of packed red, green, blue and optional alpha components. IndexColorModel(int, int, byte[], int, boolean, int). Constructor for class java.awt.image.IndexColorModel Constructs an IndexColorModel from a single arrays of packed red, green, blue and optional alpha components. IndexedPropertyDescriptor(String, Class). Constructor for class java.beans.IndexedPropertyDescriptor This constructor constructs an IndexedPropertyDescriptor for a property that follows the standard Java conventions by having getFoo and setFoo accessor methods, for both indexed access and array access. IndexedPropertyDescriptor(String, Class, String, String, String, String). Constructor for class java.beans.IndexedPropertyDescriptor This constructor takes the name of a simple property, and method names for reading and writing the property, both indexed and non-indexed. IndexedPropertyDescriptor(String, Method, Method, Method, Method). Constructor for class java.beans.IndexedPropertyDescriptor This constructor takes the name of a simple property, and Method objects for reading and writing the property. indexOf(int). Method in class java.lang.String Returns the index within this string of the first occurrence of the specified character. indexOf(int, int). Method in class java.lang.String Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index. indexOf(Object). Method in class java.util.Vector Searches for the first occurence of the given argument, testing for equality using the equals method. indexOf(Object, int). Method in class java.util.Vector

ww w. ja

va
359

dil

i.c o

m

360
Searches for the first occurence of the given argument, beginning the search at index, and testing for equality using the equals method. indexOf(String). Method in class java.lang.String Returns the index within this string of the first occurrence of the specified substring. indexOf(String, int). Method in class java.lang.String Returns the index within this string of the first occurrence of the specified substring, starting at the specified index. IndexOutOfBoundsException(). Constructor for class java.lang.IndexOutOfBoundsException Constructs an IndexOutOfBoundsException with no detail message. IndexOutOfBoundsException(String). Constructor for class java.lang.IndexOutOfBoundsException Constructs an IndexOutOfBoundsException with the specified detail message. inf. Variable in class java.util.zip.InflaterInputStream Decompressor for this stream. inflate(byte[]). Method in class java.util.zip.Inflater Uncompresses bytes into specified buffer. inflate(byte[], int, int). Method in class java.util.zip.Inflater Uncompresses bytes into specified buffer. Inflater(). Constructor for class java.util.zip.Inflater Creates a new decompressor. Inflater(boolean). Constructor for class java.util.zip.Inflater Creates a new decompressor. InflaterInputStream(InputStream). Constructor for class java.util.zip.InflaterInputStream Creates a new input stream with a default decompressor and buffer size. InflaterInputStream(InputStream, Inflater). Constructor for class java.util.zip.InflaterInputStream Creates a new input stream with the specified decompressor and a default buffer size. InflaterInputStream(InputStream, Inflater, int). Constructor for class java.util.zip.InflaterInputStream Creates a new input stream with the specified decompressor and buffer size. info. Static variable in class java.awt.SystemColor The background color for info(help) text. INFO. Static variable in class java.awt.SystemColor The array index for the info background color. INFO_TEXT. Static variable in class java.awt.SystemColor The array index for the info text color. infoText. Static variable in class java.awt.SystemColor The text color for info(help) text. init(). Method in class java.applet.Applet Called by the browser or applet viewer to inform this applet that it has been loaded into the system. initialize(DSAParams, SecureRandom). Method in interface java.security.interfaces.DSAKeyPairGenerator Initializes the key pair generator using p, q and g, the DSA family parameters. initialize(int). Method in class java.security.KeyPairGenerator Initializes the key pair generator for a certain strength using a system-provided source of randomness. initialize(int, boolean, SecureRandom). Method in interface java.security.interfaces.DSAKeyPairGenerator Initializes the key pair generator for a given modulus length, without parameters. initialize(int, SecureRandom). Method in class java.security.KeyPairGenerator Initializes the key pair generator for a certain strength. initSign(PrivateKey). Method in class java.security.Signature Initialize this object for signing. initVerify(PublicKey). Method in class java.security.Signature Initializes this object for verification. InputStream(). Constructor for class java.io.InputStream InputStreamReader(InputStream). Constructor for class java.io.InputStreamReader Create an InputStreamReader that uses the default character encoding. InputStreamReader(InputStream, String). Constructor for class java.io.InputStreamReader Create an InputStreamReader that uses the named character encoding. inScope(). Method in class sun.tools.debug.RemoteStackVariable Return whether variable is in scope. INSERT. Static variable in class java.awt.Event The Insert key. insert(int, boolean). Method in class java.lang.StringBuffer Inserts the string representation of the boolean argument into this string buffer. insert(int, char). Method in class java.lang.StringBuffer Inserts the string representation of the char argument into this string buffer. insert(int, char[]). Method in class java.lang.StringBuffer Inserts the string representation of the char array argument into this string buffer. insert(int, double). Method in class java.lang.StringBuffer Inserts the string representation of the double argument into this string buffer. insert(int, float). Method in class java.lang.StringBuffer Inserts the string representation of the float argument into this string buffer. insert(int, int). Method in class java.lang.StringBuffer Inserts the string representation of the second int argument into this string buffer. insert(int, long). Method in class java.lang.StringBuffer Inserts the string representation of the long argument into this string buffer. insert(int, Object). Method in class java.lang.StringBuffer Inserts the string representation of the Object argument into this string buffer. insert(int, String). Method in class java.lang.StringBuffer Inserts the string into this string buffer. insert(MenuItem, int). Method in class java.awt.Menu

ww w. ja

va
360

dil

i.c o

m

361
Inserts the MenuItem to this menu at the specified position. insert(String, int). Method in class java.awt.Choice Inserts the item into this choice at the specified position. insert(String, int). Method in class java.awt.Menu Inserts an item with the specified label to this menu at the specified position. insert(String, int). Method in class java.awt.TextArea Inserts the specified text at the specified position. insert(String, int). Method in interface java.awt.peer.TextAreaPeer insertElementAt(Object, int). Method in class java.util.Vector Inserts the specified object as a component in this vector at the specified index. insertProviderAt(Provider, int). Static method in class java.security.Security Adds a new provider, at a specified position. insertSeparator(int). Method in class java.awt.Menu Inserts a separator at the specified position insertText(String, int). Method in class java.awt.TextArea insertText(String, int). Method in interface java.awt.peer.TextAreaPeer DEPRECATED: Replaced by insert(String, int). insets. Variable in class java.awt.GridBagConstraints insets(). Method in class java.awt.Container insets(). Method in interface java.awt.peer.ContainerPeer DEPRECATED: Replaced by getInsets(). Insets(int, int, int, int). Constructor for class java.awt.Insets Constructs and initializes a new Inset with the specified top, left, bottom, and right insets. inside(int, int). Method in class java.awt.Component inside(int, int). Method in class java.awt.Polygon inside(int, int). Method in class java.awt.Rectangle instantiate(ClassLoader, String). Static method in class java.beans.Beans Instantiate a bean. InstantiationError(). Constructor for class java.lang.InstantiationError Constructs an InstantiationError with no detail message. InstantiationError(String). Constructor for class java.lang.InstantiationError Constructs an InstantiationError with the specified detail message. InstantiationException(). Constructor for class java.lang.InstantiationException Constructs an InstantiationException with no detail message. InstantiationException(String). Constructor for class java.lang.InstantiationException Constructs an InstantiationException with the specified detail message. intBitsToFloat(int). Static method in class java.lang.Float Returns the single-float corresponding to a given bit represention. INTEGER. Static variable in class java.sql.Types Integer(int). Constructor for class java.lang.Integer Constructs a newly allocated Integer object that represents the primitive int argument. Integer(String). Constructor for class java.lang.Integer Constructs a newly allocated Integer object that represents the value represented by the string. INTEGER_FIELD. Static variable in class java.text.NumberFormat Field constant used to construct a FieldPosition object. INTERFACE. Static variable in class java.lang.reflect.Modifier intern(). Method in class java.lang.String Returns a canonical representation for the string object. InternalError(). Constructor for class java.lang.InternalError Constructs an InternalError with no detail message. InternalError(String). Constructor for class java.lang.InternalError Constructs an InternalError with the specified detail message. internalGet(int). Method in class java.util.Calendar Gets the value for a given time field. interrupt(). Method in class java.lang.Thread Interrupts this thread. interrupted(). Static method in class java.lang.Thread Tests is the current thread has been interrupted. InterruptedException(). Constructor for class java.lang.InterruptedException Constructs an InterruptedException with no detail message. InterruptedException(String). Constructor for class java.lang.InterruptedException Constructs an InterruptedException with the specified detail message. InterruptedIOException(). Constructor for class java.io.InterruptedIOException Constructs an InterruptedIOException with no detail message. InterruptedIOException(String). Constructor for class java.io.InterruptedIOException Constructs an InterruptedIOException with the specified detail message. intersection(Rectangle). Method in class java.awt.Rectangle Computes the intersection of two rectangles. intersects(Rectangle). Method in class java.awt.Rectangle Checks if two rectangles intersect. IntrospectionException(String). Constructor for class java.beans.IntrospectionException intValue(). Method in class java.math.BigDecimal Converts this number to an int. intValue(). Method in class java.math.BigInteger Converts this number to an int. intValue(). Method in class java.lang.Byte

ww w. ja

va
361

dil

i.c o

m

362
Returns the value of this Byte as an int. intValue(). Method in class java.lang.Double Returns the integer value of this Double (by casting to an int). intValue(). Method in class java.lang.Float Returns the integer value of this Float (by casting to an int). intValue(). Method in class java.lang.Integer Returns the value of this Integer as an int. intValue(). Method in class java.lang.Long Returns the value of this Long as an int. intValue(). Method in class java.lang.Number Returns the value of the specified number as an int. intValue(). Method in class java.lang.Short Returns the value of this Short as an int. invalidate(). Method in class java.awt.Component Invalidates the component. invalidate(). Method in class java.awt.Container Invalidates the container. invalidateLayout(Container). Method in class java.awt.BorderLayout Invalidates the layout, indicating that if the layout manager has cached information it should be discarded. invalidateLayout(Container). Method in class java.awt.CardLayout Invalidates the layout, indicating that if the layout manager has cached information it should be discarded. invalidateLayout(Container). Method in class java.awt.GridBagLayout Invalidates the layout, indicating that if the layout manager has cached information it should be discarded. invalidateLayout(Container). Method in interface java.awt.LayoutManager2 Invalidates the layout, indicating that if the layout manager has cached information it should be discarded. InvalidClassException(String). Constructor for class java.io.InvalidClassException Report a InvalidClassException for the specified reason. InvalidClassException(String, String). Constructor for class java.io.InvalidClassException InvalidKeyException(). Constructor for class java.security.InvalidKeyException Constructs an InvalidKeyException with no detail message. InvalidKeyException(String). Constructor for class java.security.InvalidKeyException Constructs an InvalidKeyException with the specified detail message. InvalidObjectException(String). Constructor for class java.io.InvalidObjectException Raised by a class when it is explicitly disallowing itself to be serialized. InvalidParameterException(). Constructor for class java.security.InvalidParameterException Constructs an InvalidParameterException with no detail message. InvalidParameterException(String). Constructor for class java.security.InvalidParameterException Constructs an InvalidParameterException with the specified detail message. InvocationTargetException(). Constructor for class java.lang.reflect.InvocationTargetException InvocationTargetException(Throwable). Constructor for class java.lang.reflect.InvocationTargetException Constructs a InvocationTargetException with a target exception. InvocationTargetException(Throwable, String). Constructor for class java.lang.reflect.InvocationTargetException Constructs a InvocationTargetException with a target exception and a detail message. invoke(Object, Object[]). Method in class java.lang.reflect.Method Invokes the underlying method represented by this Method object, on the specified object with the specified parameters. invoke(RemoteCall). Method in interface java.rmi.server.RemoteRef Executes the remote call. IOException(). Constructor for class java.io.IOException Constructs an IOException with no detail message. IOException(String). Constructor for class java.io.IOException Constructs an IOException with the specified detail message. ipadx. Variable in class java.awt.GridBagConstraints ipady. Variable in class java.awt.GridBagConstraints isAbsolute(). Method in class java.io.File Tests if the file represented by this File object is an absolute pathname. isAbstract(int). Static method in class java.lang.reflect.Modifier Return true if the specifier integer includes the abstract modifier. isActionKey(). Method in class java.awt.event.KeyEvent Returns whether or not the key in this event is an "action" key. isActive(). Method in class java.applet.Applet Determines if this applet is active. isActive(). Method in interface java.applet.AppletStub Determines if the applet is active. isAlive(). Method in class java.lang.Thread Tests if this thread is alive. isAltDown(). Method in class java.awt.event.InputEvent Returns whether or not the Alt modifier is down on this event. isAncestorOf(Component). Method in class java.awt.Container Checks if the component is contained in the component hierarchy of this container. isArray(). Method in class java.lang.Class If this Class object represents an array type, returns true, otherwise returns false. isAssignableFrom(Class). Method in class java.lang.Class Determines if the class or interface represented by this Class object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified Class parameter. isAutoIncrement(int). Method in interface java.sql.ResultSetMetaData Is the column automatically numbered, thus read-only?

ww w. ja

va
362

dil

i.c o

m

363
isBold(). Method in class java.awt.Font Returns true if the font is bold. isBound(). Method in class java.beans.PropertyDescriptor Updates to "bound" properties will cause a "PropertyChange" event to get fired when the property is changed. isCaseSensitive(int). Method in interface java.sql.ResultSetMetaData Does a column's case matter? isCatalogAtStart(). Method in interface java.sql.DatabaseMetaData Does a catalog appear at the start of a qualified table name? (Otherwise it appears at the end) isClosed(). Method in interface java.sql.Connection Tests to see if a Connection is closed. isConstrained(). Method in class java.beans.PropertyDescriptor Attempted updates to "Constrained" properties will cause a "VetoableChange" event to get fired when the property is changed. isConsumed(). Method in class java.awt.AWTEvent isConsumed(). Method in class java.awt.event.InputEvent Returns whether or not this event has been consumed. isConsumer(ImageConsumer). Method in class java.awt.image.FilteredImageSource Determines whether an ImageConsumer is on the list of consumers currently interested in data for this image. isConsumer(ImageConsumer). Method in interface java.awt.image.ImageProducer This method determines if a given ImageConsumer object is currently registered with this ImageProducer as one of its consumers. isConsumer(ImageConsumer). Method in class java.awt.image.MemoryImageSource Determine if an ImageConsumer is on the list of consumers currently interested in data for this image. isControlDown(). Method in class java.awt.event.InputEvent Returns whether or not the Control modifier is down on this event. isCurrency(int). Method in interface java.sql.ResultSetMetaData Is the column a cash value? isDaemon(). Method in class java.lang.Thread Tests if this thread is a daemon thread. isDaemon(). Method in class java.lang.ThreadGroup Tests if this thread group is a daemon thread group. isDataFlavorSupported(DataFlavor). Method in class java.awt.datatransfer.StringSelection Returns whether the requested flavor is supported by this object. isDataFlavorSupported(DataFlavor). Method in interface java.awt.datatransfer.Transferable Returns whether or not the specified data flavor is supported for this object. isDecimalSeparatorAlwaysShown(). Method in class java.text.DecimalFormat Allows you to get the behavior of the decimal separator with integers. isDefined(char). Static method in class java.lang.Character Determines if a character has a defined meaning in Unicode. isDefinitelyWritable(int). Method in interface java.sql.ResultSetMetaData Will a write on the column definitely succeed? isDesignTime(). Static method in class java.beans.Beans Test if we are in design-mode. isDestroyed(). Method in class java.lang.ThreadGroup Tests if this thread group has not been destroyed. isDigit(char). Static method in class java.lang.Character Determines if the specified character is a digit. isDirectory(). Method in class java.io.File Tests if the file represented by this File object is a directory. isDirectory(). Method in class java.util.zip.ZipEntry Returns true if this is a directory entry. isEditable(). Method in class java.awt.TextComponent Returns the boolean indicating whether this TextComponent is editable or not. isEmpty(). Method in class java.util.Dictionary Tests if this dictionary maps no keys to value. isEmpty(). Method in class java.util.Hashtable Tests if this hashtable maps no keys to values. isEmpty(). Method in class java.awt.Rectangle Determines whether the rectangle is empty. isEmpty(). Method in class java.util.Vector Tests if this vector has no components. isEnabled(). Method in class java.awt.Component Checks if this Component is enabled. isEnabled(). Method in class java.awt.MenuItem Checks whether the menu item is enabled. isEqual(byte[], byte[]). Static method in class java.security.MessageDigest Compares two digests for equality. isErrorAny(). Method in class java.awt.MediaTracker Checks the error status of all of the images. isErrorID(int). Method in class java.awt.MediaTracker Checks the error status of all of the images with the specified ID. isExpert(). Method in class java.beans.FeatureDescriptor The "expert" flag is used to distinguish between those features that are intended for expert users from those that are intended for normal users. isFile(). Method in class java.io.File Tests if the file represented by this File object is a "normal" file.

ww w. ja

va
363

dil

i.c o

m

364
isFinal(int). Static method in class java.lang.reflect.Modifier Return true if the specifier integer includes the final modifier. isFocusTraversable(). Method in class java.awt.Component Returns whether this component can be traversed using Tab or Shift-Tab keyboard focus traversal. isFocusTraversable(). Method in interface java.awt.peer.ComponentPeer isGroupingUsed(). Method in class java.text.NumberFormat Returns true if grouping is used in this format. isGuiAvailable(). Static method in class java.beans.Beans isHidden(). Method in class java.beans.FeatureDescriptor The "hidden" flag is used to identify features that are intended only for tool use, and which should not be exposed to humans. isIdentifierIgnorable(char). Static method in class java.lang.Character Determines if the specified character should be regarded as an ignorable character in a Java identifier or a Unicode identifier. isInDefaultEventSet(). Method in class java.beans.EventSetDescriptor Report if an event set is in the "default set". isIndexSelected(int). Method in class java.awt.List Returns true if the item at the specified index has been selected; false otherwise. isInfinite(). Method in class java.lang.Double Returns true if this Double value is infinitely large in magnitude. isInfinite(). Method in class java.lang.Float Returns true if this Float value is infinitely large in magnitude. isInfinite(double). Static method in class java.lang.Double Returns true if the specified number is infinitely large in magnitude. isInfinite(float). Static method in class java.lang.Float Returns true if the specified number is infinitely large in magnitude. isInstance(Object). Method in class java.lang.Class This method is the dynamic equivalent of the Java language instanceof operator. isInstanceOf(Object, Class). Static method in class java.beans.Beans Check if a bean can be viewed as a given target type. isInterface(). Method in class java.lang.Class Determines if the specified Class object represents an interface type. isInterface(). Method in class sun.tools.debug.RemoteClass Is this RemoteClass an interface? isInterface(int). Static method in class java.lang.reflect.Modifier Return true if the specifier integer includes the interface modifier. isInterrupted(). Method in class java.lang.Thread Tests if the current thread has been interrupted. isISOControl(char). Static method in class java.lang.Character Determines if the specified character is an ISO control character. isItalic(). Method in class java.awt.Font Returns true if the font is italic. isJavaIdentifierPart(char). Static method in class java.lang.Character Determines if the specified character may be part of a Java identifier as other than the first character. isJavaIdentifierStart(char). Static method in class java.lang.Character Determines if the specified character is permissible as the first character in a Java identifier. isJavaLetter(char). Static method in class java.lang.Character Determines if the specified character is a "Java" letter, that is, the character is permissible as the first character in an identifier in the Java language. isJavaLetterOrDigit(char). Static method in class java.lang.Character Determines if the specified character is a "Java" letter or digit, that is, the character is permissible as a non-initial character in an identifier in the Java language. isLeapYear(int). Method in class java.util.GregorianCalendar Determines if the given year is a leap year. isLenient(). Method in class java.util.Calendar Tell whether date/time interpretation is to be lenient. isLenient(). Method in class java.text.DateFormat Tell whether date/time parsing is to be lenient. isLetter(char). Static method in class java.lang.Character Determines if the specified character is a letter. isLetterOrDigit(char). Static method in class java.lang.Character Determines if the specified character is a letter or digit. isLowerCase(char). Static method in class java.lang.Character Determines if the specified character is a lowercase character. isMember(Principal). Method in interface java.security.acl.Group Returns true if the passed principal is a member of the group. isMetaDown(). Method in class java.awt.event.InputEvent Returns whether or not the Meta modifier is down on this event. isMimeTypeEqual(DataFlavor). Method in class java.awt.datatransfer.DataFlavor Convenience function equivalent to calling: isMimeTypeEqual(dataFlavor.getMimeType()); isMimeTypeEqual(String). Method in class java.awt.datatransfer.DataFlavor Is the string representation of the MIME type passed in equivalent to the MIME type of this DataFlavor. isModal(). Method in class java.awt.Dialog Returns true if the Dialog is modal. isMulticastAddress(). Method in class java.net.InetAddress Utility routine to check if the InetAddress is a IP multicast address. isMultipleMode(). Method in class java.awt.List Returns true if this list allows multiple selections.

ww w. ja

va
364

dil

i.c o

m

365
isNaN(). Method in class java.lang.Double Returns true if this Double value is the special Not-a-Number (NaN) value. isNaN(). Method in class java.lang.Float Returns true if this Float value is Not-a-Number (NaN). isNaN(double). Static method in class java.lang.Double Returns true if the specified number is the special Not-a-Number (NaN) value. isNaN(float). Static method in class java.lang.Float Returns true if the specified number is the special Not-a-Number (NaN) value. isNative(int). Static method in class java.lang.reflect.Modifier Return true if the specifier integer includes the native modifier. isNegative(). Method in interface java.security.acl.AclEntry Returns true if this is a negative ACL entry (one denying the associated principal the set of permissions in the entry), false otherwise. isNullable(int). Method in interface java.sql.ResultSetMetaData Can you put a NULL in this column? isObject(). Method in class sun.tools.debug.RemoteValue Returns whether the RemoteValue is an Object (as opposed to a primitive type, such as int). isOwner(Principal). Method in interface java.security.acl.Owner Returns true if the given principal is an owner of the ACL. isPaintable(). Method in interface java.beans.PropertyEditor isPaintable(). Method in class java.beans.PropertyEditorSupport isParseIntegerOnly(). Method in class java.text.NumberFormat Returns true if this format will parse numbers as integers only. isPlain(). Method in class java.awt.Font Returns true if the font is plain. isPopupTrigger(). Method in class java.awt.event.MouseEvent Returns whether or not this mouse event is the popup-menu trigger event for the platform. isPrimitive(). Method in class java.lang.Class Determines if the specified Class object represents a primitive Java type. isPrivate(int). Static method in class java.lang.reflect.Modifier Return true if the specifier integer includes the private modifier. isProbablePrime(int). Method in class java.math.BigInteger Returns true if this BigInteger is probably prime, false if it's definitely composite. isProtected(int). Static method in class java.lang.reflect.Modifier Return true if the specifier integer includes the protected modifier. isPublic(int). Static method in class java.lang.reflect.Modifier Return true if the specified integer includes the public modifier. isReadOnly(). Method in interface java.sql.Connection Tests to see if the connection is in read-only mode. isReadOnly(). Method in interface java.sql.DatabaseMetaData Is the database in read-only mode? isReadOnly(int). Method in interface java.sql.ResultSetMetaData Is a column definitely not writable? isResizable(). Method in class java.awt.Dialog Returns true if the user can resize the dialog. isResizable(). Method in class java.awt.Frame Returns true if the user can resize the Frame. isSearchable(int). Method in interface java.sql.ResultSetMetaData Can the column be used in a where clause? isSelected(int). Method in class java.awt.List isSet. Variable in class java.util.Calendar The flags which tell if a specified time field for the calendar is set. isSet(int). Method in class java.util.Calendar Determines if the given time field has a value set. isShiftDown(). Method in class java.awt.event.InputEvent Returns whether or not the Shift modifier is down on this event. isShowing(). Method in class java.awt.Component Checks if this Component is showing on screen. isShowing(). Method in class java.awt.Window Checks if this Window is showing on screen. isSigned(int). Method in interface java.sql.ResultSetMetaData Is the column a signed number? isSpace(char). Static method in class java.lang.Character Determines if the specified character is ISO-LATIN-1 white space. isSpaceChar(char). Static method in class java.lang.Character Determines if the specified character is a Unicode space character. isStatic(). Method in class sun.tools.debug.RemoteField Returns whether the field is static (a class variable or method). isStatic(int). Static method in class java.lang.reflect.Modifier Return true if the specifier integer includes the static modifier. isString(). Method in class sun.tools.debug.RemoteValue Returns whether the RemoteValue is an instance of java.lang.String. isSuspended(). Method in class sun.tools.debug.RemoteThread Return whether this thread is suspended. isSynchronized(int). Static method in class java.lang.reflect.Modifier Return true if the specifier integer includes the final modifier.

ww w. ja

va
365

dil

i.c o

m

366
isTearOff(). Method in class java.awt.Menu Returns true if this is a tear-off menu. isTemporary(). Method in class java.awt.event.FocusEvent Returns whether or not this focus change event is a temporary change. isTimeSet. Variable in class java.util.Calendar The flag which indicates if the current time is set for the calendar. isTitleCase(char). Static method in class java.lang.Character Determines if the specified character is a titlecase character. isTransient(int). Static method in class java.lang.reflect.Modifier Return true if the specifier integer includes the transient modifier. isUnicast(). Method in class java.beans.EventSetDescriptor Normally event sources are multicast. isUnicodeIdentifierPart(char). Static method in class java.lang.Character Determines if the specified character may be part of a Unicode identifier as other than the first character. isUnicodeIdentifierStart(char). Static method in class java.lang.Character Determines if the specified character is permissible as the first character in a Unicode identifier. isUnique(). Static method in class java.rmi.dgc.VMID Return true if an accurate address can be determined for this host. isUpperCase(char). Static method in class java.lang.Character Determines if the specified character is an uppercase character. isValid(). Method in class java.awt.Component Checks if this Component is valid. isVisible(). Method in class java.awt.Component Checks if this Component is visible. isVolatile(int). Static method in class java.lang.reflect.Modifier Return true if the specifier integer includes the volatile modifier. isWhitespace(char). Static method in class java.lang.Character Determines if the specified character is white space according to Java. isWritable(int). Method in interface java.sql.ResultSetMetaData Is it possible for a write on the column to succeed? ITALIAN. Static variable in class java.util.Locale Useful constant for language. ITALIC. Static variable in class java.awt.Font The italicized style constant. ITALY. Static variable in class java.util.Locale Useful constant for country. ITEM_EVENT_MASK. Static variable in class java.awt.AWTEvent The event mask for selecting item events. ITEM_FIRST. Static variable in class java.awt.event.ItemEvent Marks the first integer id for the range of item event ids. ITEM_LAST. Static variable in class java.awt.event.ItemEvent Marks the last integer id for the range of item event ids. ITEM_STATE_CHANGED. Static variable in class java.awt.event.ItemEvent The item state changed event type. ItemEvent(ItemSelectable, int, Object, int). Constructor for class java.awt.event.ItemEvent Constructs a ItemSelectEvent object with the specified ItemSelectable source, type, item, and item select state. itemStateChanged(ItemEvent). Method in class java.awt.AWTEventMulticaster Handles the itemStateChanged event by invoking the itemStateChanged methods on listener-a and listener-b. itemStateChanged(ItemEvent). Method in interface java.awt.event.ItemListener Invoked when an item's state has been changed. itrace(boolean). Method in class sun.tools.debug.RemoteDebugger Turn on/off instruction tracing.

ww w. ja
J

JANUARY. Static variable in class java.util.Calendar Useful constant for month. JAPAN. Static variable in class java.util.Locale Useful constant for country. JAPANESE. Static variable in class java.util.Locale Useful constant for language. jdbcCompliant(). Method in interface java.sql.Driver Report whether the Driver is a genuine JDBC COMPLIANT (tm) driver. join(). Method in class java.lang.Thread Waits for this thread to die. join(InetAddress). Method in class java.net.DatagramSocketImpl Join the multicast group. join(long). Method in class java.lang.Thread Waits at most millis milliseconds for this thread to die. join(long, int). Method in class java.lang.Thread Waits at most millis milliseconds plus nanos nanoseconds for this thread to die. joinGroup(InetAddress). Method in class java.net.MulticastSocket Joins a multicast group. JULY. Static variable in class java.util.Calendar

va
366

dil

i.c o

m

367
Useful constant for month. JUNE. Static variable in class java.util.Calendar Useful constant for month.

K

ww w. ja
L

key. Variable in class java.awt.Event The key code that was pressed in a keyboard event. KEY_ACTION. Static variable in class java.awt.Event The action-key press keyboard event. KEY_ACTION_RELEASE. Static variable in class java.awt.Event The action-key release keyboard event. KEY_EVENT_MASK. Static variable in class java.awt.AWTEvent The event mask for selecting key events. KEY_FIRST. Static variable in class java.awt.event.KeyEvent Marks the first integer id for the range of key event ids. KEY_LAST. Static variable in class java.awt.event.KeyEvent Marks the last integer id for the range of key event ids. KEY_PRESS. Static variable in class java.awt.Event The key press keyboard event. KEY_PRESSED. Static variable in class java.awt.event.KeyEvent The key pressed event type. KEY_RELEASE. Static variable in class java.awt.Event The key release keyboard event. KEY_RELEASED. Static variable in class java.awt.event.KeyEvent The key released event type. KEY_TYPED. Static variable in class java.awt.event.KeyEvent The key typed event type. KeyAdapter(). Constructor for class java.awt.event.KeyAdapter keyDown(Event, int). Method in class java.awt.Component KeyEvent(Component, int, long, int, int). Constructor for class java.awt.event.KeyEvent KeyEvent(Component, int, long, int, int, char). Constructor for class java.awt.event.KeyEvent Constructs a KeyEvent object with the specified source component, type, modifiers, and key. KeyException(). Constructor for class java.security.KeyException Constructs a KeyException with no detail message. KeyException(String). Constructor for class java.security.KeyException Constructs a KeyException with the specified detail message. KeyManagementException(). Constructor for class java.security.KeyManagementException Constructs a KeyManagementException with no detail message. KeyManagementException(String). Constructor for class java.security.KeyManagementException Constructs a KeyManagementException with the specified detail message. KeyPair(PublicKey, PrivateKey). Constructor for class java.security.KeyPair Constructs a key with the specified public key and private key. KeyPairGenerator(String). Constructor for class java.security.KeyPairGenerator Creates a KeyPairGenerator object for the specified algorithm. keyPressed(KeyEvent). Method in class java.awt.AWTEventMulticaster Handles the keyPressed event by invoking the keyPressed methods on listener-a and listener-b. keyPressed(KeyEvent). Method in class java.awt.event.KeyAdapter keyPressed(KeyEvent). Method in interface java.awt.event.KeyListener Invoked when a key has been pressed. keyReleased(KeyEvent). Method in class java.awt.AWTEventMulticaster Handles the keyReleased event by invoking the keyReleased methods on listener-a and listener-b. keyReleased(KeyEvent). Method in class java.awt.event.KeyAdapter keyReleased(KeyEvent). Method in interface java.awt.event.KeyListener Invoked when a key has been released. keys(). Method in class java.util.Dictionary Returns an enumeration of the keys in this dictionary. keys(). Method in class java.util.Hashtable Returns an enumeration of the keys in this hashtable. keyTyped(KeyEvent). Method in class java.awt.AWTEventMulticaster Handles the keyTyped event by invoking the keyTyped methods on listener-a and listener-b. keyTyped(KeyEvent). Method in class java.awt.event.KeyAdapter keyTyped(KeyEvent). Method in interface java.awt.event.KeyListener Invoked when a key has been typed. keyUp(Event, int). Method in class java.awt.Component KOREA. Static variable in class java.util.Locale Useful constant for country. KOREAN. Static variable in class java.util.Locale Useful constant for language.

va
367

dil

i.c o

m

368
Label(). Constructor for class java.awt.Label Constructs an empty label. Label(String). Constructor for class java.awt.Label Constructs a new label with the specified String of text. Label(String, int). Constructor for class java.awt.Label Constructs a new label with the specified String of text and the specified alignment. last(). Method in class java.text.BreakIterator Return the last boundary. last(). Method in interface java.text.CharacterIterator Set the position to getEndIndex()-1, return the character at that position. last(). Method in class java.text.StringCharacterIterator Set the position to getEndIndex() and return the character at that position. last(Container). Method in class java.awt.CardLayout Flips to the last card of the specified container. lastElement(). Method in class java.util.Vector Returns the last component of the vector. lastIndexOf(int). Method in class java.lang.String Returns the index within this string of the last occurrence of the specified character. lastIndexOf(int, int). Method in class java.lang.String Returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index. lastIndexOf(Object). Method in class java.util.Vector Returns the index of the last occurrence of the specified object in this vector. lastIndexOf(Object, int). Method in class java.util.Vector Searches backwards for the specified object, starting from the specified index, and returns an index to it. lastIndexOf(String). Method in class java.lang.String Returns the index within this string of the rightmost occurrence of the specified substring. lastIndexOf(String, int). Method in class java.lang.String Returns the index within this string of the last occurrence of the specified substring. lastModified(). Method in class java.io.File Returns the time that the file represented by this File object was last modified. LastOwnerException(). Constructor for class java.security.acl.LastOwnerException Constructs a LastOwnerException. lastPageFirst(). Method in class java.awt.PrintJob Returns true if the last page will be printed first. layout(). Method in class java.awt.Component layout(). Method in class java.awt.Container layout(). Method in class java.awt.ScrollPane layoutContainer(Container). Method in class java.awt.BorderLayout Lays out the specified container. layoutContainer(Container). Method in class java.awt.CardLayout Performs a layout in the specified panel. layoutContainer(Container). Method in class java.awt.FlowLayout Lays out the container. layoutContainer(Container). Method in class java.awt.GridBagLayout Lays out the container in the specified panel. layoutContainer(Container). Method in class java.awt.GridLayout Lays out the container in the specified panel. layoutContainer(Container). Method in interface java.awt.LayoutManager Lays out the container in the specified panel. layoutInfo. Variable in class java.awt.GridBagLayout Lease(VMID, long). Constructor for class java.rmi.dgc.Lease Constructs a lease with a specific VMID and lease duration. leave(InetAddress). Method in class java.net.DatagramSocketImpl Leave the multicast group. leaveGroup(InetAddress). Method in class java.net.MulticastSocket Leave a multicast group. LEFT. Static variable in class java.awt.Event The left arrow action-key. LEFT. Static variable in class java.awt.FlowLayout The left alignment variable. left. Variable in class java.awt.Insets The inset from the left. LEFT. Static variable in class java.awt.Label The left alignment. LEFT_ALIGNMENT. Static variable in class java.awt.Component Ease of use constant for getAlignmentX(). len. Variable in class java.util.zip.InflaterInputStream Length of input buffer. length. Variable in class java.io.OptionalDataException The number of bytes available to be read in the current buffer. length(). Method in class java.io.File Returns the length of the file represented by this File object. length(). Method in class java.io.RandomAccessFile Returns the length of this file. length(). Method in class java.lang.String

ww w. ja

va
368

dil

i.c o

m

369
Returns the length of this string. length(). Method in class java.lang.StringBuffer Returns the length (character count) of this string buffer. LETTER_NUMBER. Static variable in class java.lang.Character lightGray. Static variable in class java.awt.Color The color light gray. LINE_SEPARATOR. Static variable in class java.lang.Character lineno(). Method in class java.io.StreamTokenizer Return the current line number. LineNumberInputStream(InputStream). Constructor for class java.io.LineNumberInputStream Constructs a newline number input stream that reads its input from the specified input stream. LineNumberReader(Reader). Constructor for class java.io.LineNumberReader Create a new line-numbering reader, using the default input-buffer size. LineNumberReader(Reader, int). Constructor for class java.io.LineNumberReader Create a new line-numbering reader, reading characters into a buffer of the given size. LinkageError(). Constructor for class java.lang.LinkageError Constructs a LinkageError with no detail message. LinkageError(String). Constructor for class java.lang.LinkageError Constructs a LinkageError with the specified detail message. list(). Method in class java.awt.Component Prints a listing to System.out. list(). Method in class java.io.File Returns a list of the files in the directory specified by this File object. List(). Constructor for class java.awt.List Creates a new scrolling list initialized with no visible Lines or multiple selections. list(). Method in interface java.rmi.registry.Registry Returns an array of the names in the registry. list(). Method in class java.lang.ThreadGroup Prints information about this thread group to the standard output. list(FilenameFilter). Method in class java.io.File Returns a list of the files in the directory specified by this File that satisfy the specified filter. List(int). Constructor for class java.awt.List Creates a new scrolling list initialized with the specified number of visible lines and a boolean stating whether multiple selections are allowed or not. List(int, boolean). Constructor for class java.awt.List Creates a new scrolling list initialized with the specified number of visible lines and a boolean stating whether multiple selections are allowed or not. list(PrintStream). Method in class java.awt.Component Prints a listing to the specified print stream. list(PrintStream). Method in class java.util.Properties Prints this property list out to the specified output stream. list(PrintStream, int). Method in class java.awt.Component Prints out a list, starting at the specified indention, to the specified print stream. list(PrintStream, int). Method in class java.awt.Container Prints out a list, starting at the specified indention, to the specified out stream. list(PrintWriter). Method in class java.awt.Component Prints a listing to the specified print writer. list(PrintWriter). Method in class java.util.Properties Prints this property list out to the specified output stream. list(PrintWriter, int). Method in class java.awt.Component Prints out a list, starting at the specified indention, to the specified print writer. list(PrintWriter, int). Method in class java.awt.Container Prints out a list, starting at the specified indention, to the specified print writer. list(String). Static method in class java.rmi.Naming Returns an array of strings of the URLs in the registry. LIST_DESELECT. Static variable in class java.awt.Event LIST_SELECT. Static variable in class java.awt.Event listBreakpoints(). Method in class sun.tools.debug.RemoteDebugger Return a list of the breakpoints which are currently set. listClasses(). Method in class sun.tools.debug.RemoteDebugger List the currently known classes. listen(int). Method in class java.net.SocketImpl Sets the maximum queue length for incoming connection indications (a request to connect) to the count argument. ListResourceBundle(). Constructor for class java.util.ListResourceBundle listThreadGroups(RemoteThreadGroup). Method in class sun.tools.debug.RemoteDebugger List threadgroups listThreads(boolean). Method in class sun.tools.debug.RemoteThreadGroup List a threadgroup's threads LOAD. Static variable in class java.awt.FileDialog The file load variable. load(InputStream). Method in class java.util.Properties Reads a property list from an input stream. load(String). Method in class java.lang.Runtime Loads the specified filename as a dynamic library. load(String). Static method in class java.lang.System Loads the specified filename as a dynamic library.

ww w. ja

va
369

dil

i.c o

m

370
LOAD_FILE. Static variable in class java.awt.Event A file loading event. loadClass(String). Method in class java.lang.ClassLoader Requests the class loader to load a class with the specified name. loadClass(String). Method in interface java.rmi.server.LoaderHandler Load class using java.rmi.server.codebase property. loadClass(String). Static method in class java.rmi.server.RMIClassLoader Load a class from the URL specified in the java.rmi.server.codebase property. loadClass(String, boolean). Method in class java.lang.ClassLoader Resolves the specified name to a Class. loadClass(URL, String). Method in interface java.rmi.server.LoaderHandler Load class from codebase URL specified. loadClass(URL, String). Static method in class java.rmi.server.RMIClassLoader Load a class from a URL. loadImage(String). Method in class java.beans.SimpleBeanInfo This is a utility method to help in loading icon images. LOADING. Static variable in class java.awt.MediaTracker Flag indicating some media is currently being loaded. loadLibrary(String). Method in class java.lang.Runtime Loads the dynamic library with the specified library name. loadLibrary(String). Static method in class java.lang.System Loads the system library specified by the libname argument. loadSystemColors(int[]). Method in class java.awt.Toolkit Fills in the provided int array with the current system color values locale. Variable in class java.awt.Component The locale for the component. Locale(String, String). Constructor for class java.util.Locale Construct a locale from language, country. Locale(String, String, String). Constructor for class java.util.Locale Construct a locale from language, country, variant. localPort. Variable in class java.net.DatagramSocketImpl localport. Variable in class java.net.SocketImpl The local port number to which this socket is connected. locate(int, int). Method in class java.awt.Component locate(int, int). Method in class java.awt.Container location(). Method in class java.awt.Component location(int, int). Method in class java.awt.GridBagLayout lock. Variable in class java.io.Reader The object used to synchronize operations on this stream. lock. Variable in class java.io.Writer The object used to synchronize operations on this stream. log(double). Static method in class java.lang.Math Returns the natural logarithm (base e) of a double value. log(String). Static method in class java.rmi.server.LogStream Return the LogStream identified by the given name. LONG. Static variable in class java.text.DateFormat Constant for long style pattern. Long(long). Constructor for class java.lang.Long Constructs a newly allocated Long object that represents the primitive long argument. Long(String). Constructor for class java.lang.Long Constructs a newly allocated Long object that represents the value represented by the string. longBitsToDouble(long). Static method in class java.lang.Double Returns the double-float corresponding to a given bit represention. longValue(). Method in class java.math.BigDecimal Converts this number to a long. longValue(). Method in class java.math.BigInteger Converts this number to a long. longValue(). Method in class java.lang.Byte Returns the value of this Byte as a long. longValue(). Method in class java.lang.Double Returns the long value of this Double (by casting to a long). longValue(). Method in class java.lang.Float Returns the long value of this Float (by casting to a long). longValue(). Method in class java.lang.Integer Returns the value of this Integer as a long. longValue(). Method in class java.lang.Long Returns the value of this Long as a long. longValue(). Method in class java.lang.Number Returns the value of the specified number as a long. longValue(). Method in class java.lang.Short Returns the value of this Short as a long. LONGVARBINARY. Static variable in class java.sql.Types LONGVARCHAR. Static variable in class java.sql.Types lookup(Class). Static method in class java.io.ObjectStreamClass Find the descriptor for a class that can be serialized. lookup(String). Static method in class java.rmi.Naming

ww w. ja

va
370

dil

i.c o

m

371
Returns the remote object for the URL. lookup(String). Method in interface java.rmi.registry.Registry Returns the remote object associated with the specified name in the registry. lookupConstraints(Component). Method in class java.awt.GridBagLayout Retrieves the constraints for the specified component. loop(). Method in interface java.applet.AudioClip Starts playing this audio clip in a loop. LOST_FOCUS. Static variable in class java.awt.Event A component lost the focus. lostFocus(Event, Object). Method in class java.awt.Component lostOwnership(Clipboard, Transferable). Method in interface java.awt.datatransfer.ClipboardOwner Notifies this object that it is no longer the owner of the contents of the clipboard. lostOwnership(Clipboard, Transferable). Method in class java.awt.datatransfer.StringSelection LOWERCASE_LETTER. Static variable in class java.lang.Character lowerCaseMode(boolean). Method in class java.io.StreamTokenizer Determines whether or not word token are automatically lowercased.

M

ww w. ja

magenta. Static variable in class java.awt.Color The color magneta. makeVisible(int). Method in class java.awt.List Forces the item at the specified index to be visible. makeVisible(int). Method in interface java.awt.peer.ListPeer MalformedURLException(). Constructor for class java.net.MalformedURLException Constructs a MalformedURLException with no detail message. MalformedURLException(String). Constructor for class java.net.MalformedURLException Constructs a MalformedURLException with the specified detail message. MARCH. Static variable in class java.util.Calendar Useful constant for month. mark. Variable in class java.io.ByteArrayInputStream The currently marked position in the stream. mark(int). Method in class java.io.BufferedInputStream Marks the current position in this input stream. mark(int). Method in class java.io.BufferedReader Mark the present position in the stream. mark(int). Method in class java.io.ByteArrayInputStream Set the current marked position in the stream. mark(int). Method in class java.io.CharArrayReader Mark the present position in the stream. mark(int). Method in class java.io.FilterInputStream Marks the current position in this input stream. mark(int). Method in class java.io.FilterReader Mark the present position in the stream. mark(int). Method in class java.io.InputStream Marks the current position in this input stream. mark(int). Method in class java.io.LineNumberInputStream Marks the current position in this input stream. mark(int). Method in class java.io.LineNumberReader Mark the present position in the stream. mark(int). Method in class java.io.Reader Mark the present position in the stream. mark(int). Method in class java.io.StringReader Mark the present position in the stream. markedPos. Variable in class java.io.CharArrayReader Position of mark in buffer marklimit. Variable in class java.io.BufferedInputStream The maximum read ahead allowed after a call to the mark method before subsequent calls to the reset method fail. markpos. Variable in class java.io.BufferedInputStream The value of the pos field at the time the last mark method was called. markSupported(). Method in class java.io.BufferedInputStream Tests if this input stream supports the mark and reset methods. markSupported(). Method in class java.io.BufferedReader Tell whether this stream supports the mark() operation, which it does. markSupported(). Method in class java.io.ByteArrayInputStream Tests if ByteArrayInputStream supports mark/reset. markSupported(). Method in class java.io.CharArrayReader Tell whether this stream supports the mark() operation, which it does. markSupported(). Method in class java.io.FilterInputStream Tests if this input stream supports the mark and reset methods. markSupported(). Method in class java.io.FilterReader Tell whether this stream supports the mark() operation. markSupported(). Method in class java.io.InputStream Tests if this input stream supports the mark and reset methods.

va
371

dil

i.c o

m

372
markSupported(). Method in class java.io.PushbackInputStream Tests if the input stream supports the mark and reset methods. markSupported(). Method in class java.io.PushbackReader Tell whether this stream supports the mark() operation, which it does not. markSupported(). Method in class java.io.Reader Tell whether this stream supports the mark() operation. markSupported(). Method in class java.io.StringReader Tell whether this stream supports the mark() operation, which it does. MarshalException(String). Constructor for class java.rmi.MarshalException Create a new marshal exception with a descriptive string. MarshalException(String, Exception). Constructor for class java.rmi.MarshalException Create a new marshal exception with a descriptive string and an exception. MATH_SYMBOL. Static variable in class java.lang.Character max(BigDecimal). Method in class java.math.BigDecimal Returns the BigDecimal whose value is the greater of this and val. max(BigInteger). Method in class java.math.BigInteger Returns the BigInteger whose value is the greater of this and val. max(double, double). Static method in class java.lang.Math Returns the greater of two double values. max(float, float). Static method in class java.lang.Math Returns the greater of two float values. max(int, int). Static method in class java.lang.Math Returns the greater of two int values. max(long, long). Static method in class java.lang.Math Returns the greater of two long values. MAX_PRIORITY. Static variable in class java.lang.Thread The maximum priority that a thread can have. MAX_RADIX. Static variable in class java.lang.Character The maximum radix available for conversion to and from Strings. MAX_VALUE. Static variable in class java.lang.Byte The maximum value a Byte can have. MAX_VALUE. Static variable in class java.lang.Character The constant value of this field is the largest value of type char. MAX_VALUE. Static variable in class java.lang.Double The largest positive value of type double. MAX_VALUE. Static variable in class java.lang.Float The largest positive value of type float. MAX_VALUE. Static variable in class java.lang.Integer The largest value of type int. MAX_VALUE. Static variable in class java.lang.Long The largest value of type long. MAX_VALUE. Static variable in class java.lang.Short The maximum value a Short can have. MAXGRIDSIZE. Static variable in class java.awt.GridBagLayout maximumLayoutSize(Container). Method in class java.awt.BorderLayout Returns the maximum dimensions for this layout given the components in the specified target container. maximumLayoutSize(Container). Method in class java.awt.CardLayout Returns the maximum dimensions for this layout given the components in the specified target container. maximumLayoutSize(Container). Method in class java.awt.GridBagLayout Returns the maximum dimensions for this layout given the components in the specified target container. maximumLayoutSize(Container). Method in interface java.awt.LayoutManager2 Returns the maximum size of this component. MAY. Static variable in class java.util.Calendar Useful constant for month. MediaTracker(Component). Constructor for class java.awt.MediaTracker Creates a Media tracker to track images for a given Component. MEDIUM. Static variable in class java.text.DateFormat Constant for medium style pattern. members(). Method in interface java.security.acl.Group Returns an enumeration of the members in the group. MemoryImageSource(int, int, ColorModel, byte[], int, int). Constructor for class java.awt.image.MemoryImageSource Constructs an ImageProducer object which uses an array of bytes to produce data for an Image object. MemoryImageSource(int, int, ColorModel, byte[], int, int, Hashtable). Constructor for class java.awt.image.MemoryImageSource Constructs an ImageProducer object which uses an array of bytes to produce data for an Image object. MemoryImageSource(int, int, ColorModel, int[], int, int). Constructor for class java.awt.image.MemoryImageSource Constructs an ImageProducer object which uses an array of integers to produce data for an Image object. MemoryImageSource(int, int, ColorModel, int[], int, int, Hashtable). Constructor for class java.awt.image.MemoryImageSource Constructs an ImageProducer object which uses an array of integers to produce data for an Image object. MemoryImageSource(int, int, int[], int, int). Constructor for class java.awt.image.MemoryImageSource Constructs an ImageProducer object which uses an array of integers in the default RGB ColorModel to produce data for an Image object. MemoryImageSource(int, int, int[], int, int, Hashtable). Constructor for class java.awt.image.MemoryImageSource Constructs an ImageProducer object which uses an array of integers in the default RGB ColorModel to produce data for an Image object. MENU. Static variable in class java.awt.SystemColor The array index for the menu background color.

ww w. ja

va
372

dil

i.c o

m

373
menu. Static variable in class java.awt.SystemColor The background color for menus. Menu(). Constructor for class java.awt.Menu Constructs a new Menu with an empty label. Menu(String). Constructor for class java.awt.Menu Constructs a new Menu with the specified label. Menu(String, boolean). Constructor for class java.awt.Menu Constructs a new Menu with the specified label. MENU_TEXT. Static variable in class java.awt.SystemColor The array index for the menu text color. MenuBar(). Constructor for class java.awt.MenuBar Creates a new menu bar. MenuComponent(). Constructor for class java.awt.MenuComponent MenuItem(). Constructor for class java.awt.MenuItem Constructs a new MenuItem with an empty label and no keyboard shortcut. MenuItem(String). Constructor for class java.awt.MenuItem Constructs a new MenuItem with the specified label and no keyboard shortcut. MenuItem(String, MenuShortcut). Constructor for class java.awt.MenuItem Create a MenuItem with an associated keyboard shortcut. MenuShortcut(int). Constructor for class java.awt.MenuShortcut Constructs a new MenuShortcut for the specified key. MenuShortcut(int, boolean). Constructor for class java.awt.MenuShortcut Constructs a new MenuShortcut for the specified key. menuText. Static variable in class java.awt.SystemColor The text color for menus. MessageDigest(String). Constructor for class java.security.MessageDigest Creates a message digest with the specified algorithm name. MessageFormat(String). Constructor for class java.text.MessageFormat Constructs with the specified pattern. META_MASK. Static variable in class java.awt.event.ActionEvent The meta modifier constant. META_MASK. Static variable in class java.awt.Event The meta modifier constant. META_MASK. Static variable in class java.awt.event.InputEvent The meta key modifier constant. metaDown(). Method in class java.awt.Event Checks if the meta key is down. method. Variable in class java.net.HttpURLConnection methodArgument(). Method in class sun.tools.debug.RemoteStackVariable Return whether variable is a method argument. MethodDescriptor(Method). Constructor for class java.beans.MethodDescriptor MethodDescriptor(Method, ParameterDescriptor[]). Constructor for class java.beans.MethodDescriptor MILLISECOND. Static variable in class java.util.Calendar Useful constant for date and time. MILLISECOND_FIELD. Static variable in class java.text.DateFormat Useful constant for MILLISECOND field alignment. min(BigDecimal). Method in class java.math.BigDecimal Returns the BigDecimal whose value is the lesser of this and val. min(BigInteger). Method in class java.math.BigInteger Returns the BigInteger whose value is the lesser of this and val. min(double, double). Static method in class java.lang.Math Returns the smaller of two double values. min(float, float). Static method in class java.lang.Math Returns the smaller of two float values. min(int, int). Static method in class java.lang.Math Returns the smaller of two int values. min(long, long). Static method in class java.lang.Math Returns the smaller of two long values. MIN_PRIORITY. Static variable in class java.lang.Thread The minimum priority that a thread can have. MIN_RADIX. Static variable in class java.lang.Character The minimum radix available for conversion to and from Strings. MIN_VALUE. Static variable in class java.lang.Byte The minimum value a Byte can have. MIN_VALUE. Static variable in class java.lang.Character The constant value of this field is the smallest value of type char. MIN_VALUE. Static variable in class java.lang.Double The smallest positive value of type double. MIN_VALUE. Static variable in class java.lang.Float The smallest positive value of type float. MIN_VALUE. Static variable in class java.lang.Integer The smallest value of type int. MIN_VALUE. Static variable in class java.lang.Long The smallest value of type long. MIN_VALUE. Static variable in class java.lang.Short The minimum value a Short can have.

ww w. ja

va
373

dil

i.c o

m

374
minimumLayoutSize(Container). Method in class java.awt.BorderLayout Returns the minimum dimensions needed to layout the components contained in the specified target container. minimumLayoutSize(Container). Method in class java.awt.CardLayout Calculates the minimum size for the specified panel. minimumLayoutSize(Container). Method in class java.awt.FlowLayout Returns the minimum dimensions needed to layout the components contained in the specified target container. minimumLayoutSize(Container). Method in class java.awt.GridBagLayout Returns the minimum dimensions needed to layout the components contained in the specified panel. minimumLayoutSize(Container). Method in class java.awt.GridLayout Returns the minimum dimensions needed to layout the components contained in the specified panel. minimumLayoutSize(Container). Method in interface java.awt.LayoutManager Calculates the minimum size dimensions for the specified panel given the components in the specified parent container. minimumSize(). Method in class java.awt.Component minimumSize(). Method in interface java.awt.peer.ComponentPeer DEPRECATED: Replaced by getMinimumSize(). minimumSize(). Method in class java.awt.Container minimumSize(). Method in class java.awt.List minimumSize(). Method in class java.awt.TextArea minimumSize(). Method in class java.awt.TextField minimumSize(int). Method in class java.awt.List minimumSize(int). Method in interface java.awt.peer.ListPeer DEPRECATED: Replaced by getMinimumSize(int). minimumSize(int). Method in class java.awt.TextField minimumSize(int). Method in interface java.awt.peer.TextFieldPeer DEPRECATED: Replaced by getMinimumSize(int). minimumSize(int, int). Method in class java.awt.TextArea minimumSize(int, int). Method in interface java.awt.peer.TextAreaPeer DEPRECATED: Replaced by getMinimumSize(int, int). MINSIZE. Static variable in class java.awt.GridBagLayout MINUTE. Static variable in class java.util.Calendar Useful constant for date and time. MINUTE_FIELD. Static variable in class java.text.DateFormat Useful constant for MINUTE field alignment. MissingResourceException(String, String, String). Constructor for class java.util.MissingResourceException Constructs a MissingResourceException with the specified information. mkdir(). Method in class java.io.File Creates a directory whose pathname is specified by this File object. mkdirs(). Method in class java.io.File Creates a directory whose pathname is specified by this File object, including any necessary parent directories. mod(BigInteger). Method in class java.math.BigInteger Returns a BigInteger whose value is this mod m. Modifier(). Constructor for class java.lang.reflect.Modifier MODIFIER_LETTER. Static variable in class java.lang.Character MODIFIER_SYMBOL. Static variable in class java.lang.Character modifiers. Variable in class java.awt.Event The state of the modifier keys. modInverse(BigInteger). Method in class java.math.BigInteger Returns modular multiplicative inverse of this, mod m. modPow(BigInteger, BigInteger). Method in class java.math.BigInteger Returns a BigInteger whose value is (this ** exponent) mod m. MONDAY. Static variable in class java.util.Calendar Useful constant for days of week. MONTH. Static variable in class java.util.Calendar Useful constant for date and time. MONTH_FIELD. Static variable in class java.text.DateFormat Useful constant for MONTH field alignment. MOUSE_CLICKED. Static variable in class java.awt.event.MouseEvent The mouse clicked event type. MOUSE_DOWN. Static variable in class java.awt.Event The mouse down event. MOUSE_DRAG. Static variable in class java.awt.Event The mouse drag event. MOUSE_DRAGGED. Static variable in class java.awt.event.MouseEvent The mouse dragged event type. MOUSE_ENTER. Static variable in class java.awt.Event The mouse enter event. MOUSE_ENTERED. Static variable in class java.awt.event.MouseEvent The mouse entered event type. MOUSE_EVENT_MASK. Static variable in class java.awt.AWTEvent The event mask for selecting mouse events. MOUSE_EXIT. Static variable in class java.awt.Event The mouse exit event. MOUSE_EXITED. Static variable in class java.awt.event.MouseEvent The mouse exited event type. MOUSE_FIRST. Static variable in class java.awt.event.MouseEvent Marks the first integer id for the range of mouse event ids.

ww w. ja

va
374

dil

i.c o

m

375
MOUSE_LAST. Static variable in class java.awt.event.MouseEvent Marks the last integer id for the range of mouse event ids. MOUSE_MOTION_EVENT_MASK. Static variable in class java.awt.AWTEvent The event mask for selecting mouse motion events. MOUSE_MOVE. Static variable in class java.awt.Event The mouse move event. MOUSE_MOVED. Static variable in class java.awt.event.MouseEvent The mouse moved event type. MOUSE_PRESSED. Static variable in class java.awt.event.MouseEvent The mouse pressed event type. MOUSE_RELEASED. Static variable in class java.awt.event.MouseEvent The mouse released event type. MOUSE_UP. Static variable in class java.awt.Event The mouse up event. MouseAdapter(). Constructor for class java.awt.event.MouseAdapter mouseClicked(MouseEvent). Method in class java.awt.AWTEventMulticaster Handles the mouseClicked event by invoking the mouseClicked methods on listener-a and listener-b. mouseClicked(MouseEvent). Method in class java.awt.event.MouseAdapter mouseClicked(MouseEvent). Method in interface java.awt.event.MouseListener Invoked when the mouse has been clicked on a component. mouseDown(Event, int, int). Method in class java.awt.Component mouseDrag(Event, int, int). Method in class java.awt.Component mouseDragged(MouseEvent). Method in class java.awt.AWTEventMulticaster Handles the mouseDragged event by invoking the mouseDragged methods on listener-a and listener-b. mouseDragged(MouseEvent). Method in class java.awt.event.MouseMotionAdapter mouseDragged(MouseEvent). Method in interface java.awt.event.MouseMotionListener Invoked when a mouse button is pressed on a component and then dragged. mouseEnter(Event, int, int). Method in class java.awt.Component mouseEntered(MouseEvent). Method in class java.awt.AWTEventMulticaster Handles the mouseEntered event by invoking the mouseEntered methods on listener-a and listener-b. mouseEntered(MouseEvent). Method in class java.awt.event.MouseAdapter mouseEntered(MouseEvent). Method in interface java.awt.event.MouseListener Invoked when the mouse enters a component. MouseEvent(Component, int, long, int, int, int, int, boolean). Constructor for class java.awt.event.MouseEvent Constructs a MouseEvent object with the specified source component, type, modifiers, coordinates, and click count. mouseExit(Event, int, int). Method in class java.awt.Component mouseExited(MouseEvent). Method in class java.awt.AWTEventMulticaster Handles the mouseExited event by invoking the mouseExited methods on listener-a and listener-b. mouseExited(MouseEvent). Method in class java.awt.event.MouseAdapter mouseExited(MouseEvent). Method in interface java.awt.event.MouseListener Invoked when the mouse exits a component. MouseMotionAdapter(). Constructor for class java.awt.event.MouseMotionAdapter mouseMove(Event, int, int). Method in class java.awt.Component mouseMoved(MouseEvent). Method in class java.awt.AWTEventMulticaster Handles the mouseMoved event by invoking the mouseMoved methods on listener-a and listener-b. mouseMoved(MouseEvent). Method in class java.awt.event.MouseMotionAdapter mouseMoved(MouseEvent). Method in interface java.awt.event.MouseMotionListener Invoked when the mouse button has been moved on a component (with no buttons no down). mousePressed(MouseEvent). Method in class java.awt.AWTEventMulticaster Handles the mousePressed event by invoking the mousePressed methods on listener-a and listener-b. mousePressed(MouseEvent). Method in class java.awt.event.MouseAdapter mousePressed(MouseEvent). Method in interface java.awt.event.MouseListener Invoked when a mouse button has been pressed on a component. mouseReleased(MouseEvent). Method in class java.awt.AWTEventMulticaster Handles the mouseReleased event by invoking the mouseReleased methods on listener-a and listener-b. mouseReleased(MouseEvent). Method in class java.awt.event.MouseAdapter mouseReleased(MouseEvent). Method in interface java.awt.event.MouseListener Invoked when a mouse button has been released on a component. mouseUp(Event, int, int). Method in class java.awt.Component move(int, int). Method in class java.awt.Component move(int, int). Method in class java.awt.Point Changes the point to have the specified location. move(int, int). Method in class java.awt.Rectangle MOVE_CURSOR. Static variable in class java.awt.Cursor The move cursor type. MOVE_CURSOR. Static variable in class java.awt.Frame movePointLeft(int). Method in class java.math.BigDecimal Returns a BigDecimal which is equivalent to this one with the decimal point moved n places to the left. movePointRight(int). Method in class java.math.BigDecimal Moves the decimal point the specified number of places to the right. MulticastSocket(). Constructor for class java.net.MulticastSocket Create a multicast socket. MulticastSocket(int). Constructor for class java.net.MulticastSocket Create a multicast socket and bind it to a specific port. multiply(BigDecimal). Method in class java.math.BigDecimal Returns a BigDecimal whose value is (this * val), and whose scale is this.scale() + val.scale.

ww w. ja

va
375

dil

i.c o

m

376
multiply(BigInteger). Method in class java.math.BigInteger Returns a BigInteger whose value is (this * val).

N

ww w. ja

N_RESIZE_CURSOR. Static variable in class java.awt.Cursor The north-resize cursor type. N_RESIZE_CURSOR. Static variable in class java.awt.Frame name. Variable in class java.sql.DriverPropertyInfo The name of the property. name. Variable in class java.awt.Font The logical name of this font. NaN. Static variable in class java.lang.Double A NaN value of type double. NaN. Static variable in class java.lang.Float The NaN value of type float. NATIVE. Static variable in class java.lang.reflect.Modifier nativeSQL(String). Method in interface java.sql.Connection A driver may convert the JDBC sql grammar into its system's native SQL grammar prior to sending it; nativeSQL returns the native form of the statement that the driver would have sent. NE_RESIZE_CURSOR. Static variable in class java.awt.Cursor The north-east-resize cursor type. NE_RESIZE_CURSOR. Static variable in class java.awt.Frame needsDictionary(). Method in class java.util.zip.Inflater Returns true if a preset dictionary is needed for decompression. needsGui(). Method in interface java.beans.Visibility needsInput(). Method in class java.util.zip.Deflater Returns true if the input data buffer is empty and setInput() should be called in order to provide more input. needsInput(). Method in class java.util.zip.Inflater Returns true if no data remains in the input buffer. negate(). Method in class java.math.BigDecimal Returns a BigDecimal whose value is -1 * this, and whose scale is this.scale(). negate(). Method in class java.math.BigInteger Returns a BigInteger whose value is (-1 * this). NEGATIVE_INFINITY. Static variable in class java.lang.Double The negative infinity of type double. NEGATIVE_INFINITY. Static variable in class java.lang.Float The negative infinity of type float. NegativeArraySizeException(). Constructor for class java.lang.NegativeArraySizeException Constructs a NegativeArraySizeException with no detail message. NegativeArraySizeException(String). Constructor for class java.lang.NegativeArraySizeException Constructs a NegativeArraySizeException with the specified detail message. newCall(RemoteObject, Operation[], int, long). Method in interface java.rmi.server.RemoteRef Creates an appropriate call object for a new remote method invocation on this object. newInstance(). Method in class java.lang.Class Creates a new instance of a class. newInstance(Class, int). Static method in class java.lang.reflect.Array Creates a new array with the specified component type and length. newInstance(Class, int[]). Static method in class java.lang.reflect.Array Creates a new array with the specified component type and dimensions. newInstance(Object[]). Method in class java.lang.reflect.Constructor Uses the constructor represented by this Constructor object to create and initialize a new instance of the constructor's declaring class, with the specified initialization parameters. newLine(). Method in class java.io.BufferedWriter Write a line separator. newmodel. Variable in class java.awt.image.RGBImageFilter newPixels(). Method in class java.awt.image.MemoryImageSource Send a whole new buffer of pixels to any ImageConsumers that are currently interested in the data for this image and notify them that an animation frame is complete. newPixels(byte[], ColorModel, int, int). Method in class java.awt.image.MemoryImageSource Change to a new byte array to hold the pixels for this image. newPixels(int, int, int, int). Method in class java.awt.image.MemoryImageSource Send a rectangular region of the buffer of pixels to any ImageConsumers that are currently interested in the data for this image and notify them that an animation frame is complete. newPixels(int, int, int, int, boolean). Method in class java.awt.image.MemoryImageSource Send a rectangular region of the buffer of pixels to any ImageConsumers that are currently interested in the data for this image. newPixels(int[], ColorModel, int, int). Method in class java.awt.image.MemoryImageSource Change to a new int array to hold the pixels for this image. next(). Method in class java.text.BreakIterator Return the boundary following the current boundary. next(). Method in interface java.text.CharacterIterator Increment the iterator's index by one and return the character at the new index. next(). Method in class java.text.CollationElementIterator Get the ordering priority of the next character in the string.

va
376

dil

i.c o

m

377
next(). Method in class sun.tools.debug.RemoteThread Continue execution of this thread to the next line, but don't step into a method call. next(). Method in interface java.sql.ResultSet A ResultSet is initially positioned before its first row; the first call to next makes the first row the current row; the second call makes the second row the current row, etc. next(). Method in class java.text.StringCharacterIterator Increment the iterator's index by one and return the character at the new index. next(Container). Method in class java.awt.CardLayout Flips to the next card of the specified container. next(int). Method in class java.text.BreakIterator Return the nth boundary from the current boundary next(int). Method in class java.util.Random Generates the next pseudorandom number. next(int). Method in class java.security.SecureRandom Generates an integer containing the user-specified number of pseudo-random bits (right justified, with leading zeros). nextBytes(byte[]). Method in class java.util.Random Generates a user specified number of random bytes. nextBytes(byte[]). Method in class java.security.SecureRandom Generates a user-specified number of random bytes. nextDouble(). Method in class java.util.Random Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence. nextDouble(double). Static method in class java.text.ChoiceFormat Finds the least double greater than d. nextDouble(double, boolean). Static method in class java.text.ChoiceFormat nextElement(). Method in interface java.util.Enumeration Returns the next element of this enumeration. nextElement(). Method in class java.util.StringTokenizer Returns the same value as the nextToken method, except that its declared return value is Object rather than String. nextFloat(). Method in class java.util.Random Returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence. nextFocus(). Method in class java.awt.Component nextGaussian(). Method in class java.util.Random Returns the next pseudorandom, Gaussian ("normally") distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence. nextInt(). Method in class java.util.Random Returns the next pseudorandom, uniformly distributed int value from this random number generator's sequence. nextLong(). Method in class java.util.Random Returns the next pseudorandom, uniformly distributed long value from this random number generator's sequence. nextToken(). Method in class java.io.StreamTokenizer Parses the next token from the input stream of this tokenizer. nextToken(). Method in class java.util.StringTokenizer Returns the next token from this string tokenizer. nextToken(String). Method in class java.util.StringTokenizer Returns the next token in this string tokenizer's string. NO_COMPRESSION. Static variable in class java.util.zip.Deflater Compression level for no compression. NO_DECOMPOSITION. Static variable in class java.text.Collator Decomposition mode value. NoClassDefFoundError(). Constructor for class java.lang.NoClassDefFoundError Constructs a NoClassDefFoundError with no detail message. NoClassDefFoundError(String). Constructor for class java.lang.NoClassDefFoundError Constructs a NoClassDefFoundError with the specified detail message. NON_SPACING_MARK. Static variable in class java.lang.Character NONE. Static variable in class java.awt.GridBagConstraints NORM_PRIORITY. Static variable in class java.lang.Thread The default priority that is assigned to a thread. normalizeMimeType(String). Method in class java.awt.datatransfer.DataFlavor Called for each MIME type string to give DataFlavor subtypes the opportunity to change how the normalization of MIME types is accomplished. normalizeMimeTypeParameter(String, String). Method in class java.awt.datatransfer.DataFlavor Called on DataFlavor for every MIME Type parameter to allow DataFlavor subclasses to handle special parameters like the text/plain charset parameters, whose values are case insensitive. NoRouteToHostException(). Constructor for class java.net.NoRouteToHostException Construct a new NoRouteToHostException with no detailed message. NoRouteToHostException(String). Constructor for class java.net.NoRouteToHostException Constructs a new NoRouteToHostException with the specified detail message as to why the remote host cannot be reached. NORTH. Static variable in class java.awt.BorderLayout The north layout constraint. NORTH. Static variable in class java.awt.GridBagConstraints NORTHEAST. Static variable in class java.awt.GridBagConstraints NORTHWEST. Static variable in class java.awt.GridBagConstraints NoSessionException(). Constructor for class sun.tools.debug.NoSessionException Constructor. NoSessionException(String). Constructor for class sun.tools.debug.NoSessionException

ww w. ja

va
377

dil

i.c o

m

378
Constructor with a detail message. NoSuchAlgorithmException(). Constructor for class java.security.NoSuchAlgorithmException Constructs a NoSuchAlgorithmException with no detail message. NoSuchAlgorithmException(String). Constructor for class java.security.NoSuchAlgorithmException Constructs a NoSuchAlgorithmException with the specified detail message. NoSuchElementException(). Constructor for class java.util.NoSuchElementException Constructs a NoSuchElementException with no detail message. NoSuchElementException(String). Constructor for class java.util.NoSuchElementException Constructs a NoSuchElementException with the specified detail message. NoSuchFieldError(). Constructor for class java.lang.NoSuchFieldError Constructs a NoSuchFieldException with no detail message. NoSuchFieldError(String). Constructor for class java.lang.NoSuchFieldError Constructs a NoSuchFieldException with the specified detail message. NoSuchFieldException(). Constructor for class java.lang.NoSuchFieldException Constructor. NoSuchFieldException(String). Constructor for class java.lang.NoSuchFieldException Constructor with a detail message. NoSuchLineNumberException(). Constructor for class sun.tools.debug.NoSuchLineNumberException Constructor. NoSuchLineNumberException(String). Constructor for class sun.tools.debug.NoSuchLineNumberException Constructor with a detail message. NoSuchMethodError(). Constructor for class java.lang.NoSuchMethodError NoSuchMethodError(String). Constructor for class java.lang.NoSuchMethodError Constructs a NoSuchMethodException with the specified detail message. NoSuchMethodException(). Constructor for class java.lang.NoSuchMethodException Constructs a NoSuchMethodException without a detail message. NoSuchMethodException(String). Constructor for class java.lang.NoSuchMethodException Constructs a NoSuchMethodException with a detail message. NoSuchObjectException(String). Constructor for class java.rmi.NoSuchObjectException Create a new NoSuchObjectException with a description. NoSuchProviderException(). Constructor for class java.security.NoSuchProviderException Constructs a NoSuchProviderException with no detail message. NoSuchProviderException(String). Constructor for class java.security.NoSuchProviderException Constructs a NoSuchProviderException with the specified detail message. not(). Method in class java.math.BigInteger Returns a BigInteger whose value is (~this). NotActiveException(). Constructor for class java.io.NotActiveException Constructor to create a new NotActiveException with no reason. NotActiveException(String). Constructor for class java.io.NotActiveException Constructor to create a new NotActiveException with the reason given. NotBoundException(). Constructor for class java.rmi.NotBoundException NotBoundException(String). Constructor for class java.rmi.NotBoundException notify(). Method in class java.lang.Object Wakes up a single thread that is waiting on this object's monitor. notifyAll(). Method in class java.lang.Object Wakes up all threads that are waiting on this object's monitor. notifyObservers(). Method in class java.util.Observable If this object has changed, as indicated by the hasChanged method, then notify all of its observers and then call the clearChanged method to indicate that this object has no longer changed. notifyObservers(Object). Method in class java.util.Observable If this object has changed, as indicated by the hasChanged method, then notify all of its observers and then call the clearChanged method to indicate that this object has no longer changed. NotOwnerException(). Constructor for class java.security.acl.NotOwnerException Constructs a NotOwnerException. NotSerializableException(). Constructor for class java.io.NotSerializableException NotSerializableException(String). Constructor for class java.io.NotSerializableException NOVEMBER. Static variable in class java.util.Calendar Useful constant for month. npoints. Variable in class java.awt.Polygon The total number of points. NULL. Static variable in class java.sql.Types NULLORDER. Static variable in class java.text.CollationElementIterator Null order which indicates the end of string is reached by the cursor. nullPlusNonNullIsNull(). Method in interface java.sql.DatabaseMetaData Are concatenations between NULL and non-NULL values NULL? A JDBC-Compliant driver always returns true. NullPointerException(). Constructor for class java.lang.NullPointerException Constructs a NullPointerException with no detail message. NullPointerException(String). Constructor for class java.lang.NullPointerException Constructs a NullPointerException with the specified detail message. nullsAreSortedAtEnd(). Method in interface java.sql.DatabaseMetaData Are NULL values sorted at the end regardless of sort order? nullsAreSortedAtStart(). Method in interface java.sql.DatabaseMetaData Are NULL values sorted at the start regardless of sort order? nullsAreSortedHigh(). Method in interface java.sql.DatabaseMetaData Are NULL values sorted high? nullsAreSortedLow(). Method in interface java.sql.DatabaseMetaData

ww w. ja

va
378

dil

i.c o

m

379
Are NULL values sorted low? NUM_COLORS. Static variable in class java.awt.SystemColor The number of system colors in the array. NUM_LOCK. Static variable in class java.awt.Event The NumLock action-key. Number(). Constructor for class java.lang.Number numberFormat. Variable in class java.text.DateFormat The number formatter that DateFormat uses to format numbers in dates and times. NumberFormat(). Constructor for class java.text.NumberFormat NumberFormatException(). Constructor for class java.lang.NumberFormatException Constructs a NumberFormatException with no detail message. NumberFormatException(String). Constructor for class java.lang.NumberFormatException Constructs a NumberFormatException with the specified detail message. NUMERIC. Static variable in class java.sql.Types nval. Variable in class java.io.StreamTokenizer If the current token is a number, this field contains the value of that number. NW_RESIZE_CURSOR. Static variable in class java.awt.Cursor The north-west-resize cursor type. NW_RESIZE_CURSOR. Static variable in class java.awt.Frame

O

ww w. ja

Object(). Constructor for class java.lang.Object ObjectInputStream(InputStream). Constructor for class java.io.ObjectInputStream Create an ObjectInputStream that reads from the specified InputStream. ObjectOutputStream(OutputStream). Constructor for class java.io.ObjectOutputStream Creates an ObjectOutputStream that writes to the specified OutputStream. ObjectStreamException(). Constructor for class java.io.ObjectStreamException Create an ObjectStreamException. ObjectStreamException(String). Constructor for class java.io.ObjectStreamException Create an ObjectStreamException with the specified argument. ObjID(). Constructor for class java.rmi.server.ObjID Generate unique object identifier. ObjID(int). Constructor for class java.rmi.server.ObjID Generate a "well-known" object ID. Observable(). Constructor for class java.util.Observable Creates an observable object with no observers. OCTOBER. Static variable in class java.util.Calendar Useful constant for month. okToUseGui(). Method in interface java.beans.Visibility This method instructs the bean that it is OK to use the Gui. on(boolean). Method in class java.security.DigestInputStream Turns the digest function on or off. on(boolean). Method in class java.security.DigestOutputStream Turns the digest function on or off. openConnection(). Method in class java.net.URL Returns a URLConnection object that represents a connection to the remote object referred to by the URL. openConnection(URL). Method in class java.net.URLStreamHandler Opens a connection to the object referenced by the URL argument. openStream(). Method in class java.net.URL Opens a connection to this URL and returns an InputStream for reading from that connection. Operation(String). Constructor for class java.rmi.server.Operation Creates a new Operation object. or(BigInteger). Method in class java.math.BigInteger Returns a BigInteger whose value is (this | val). or(BitSet). Method in class java.util.BitSet Performs a logical OR of this bit set with the bit set argument. orange. Static variable in class java.awt.Color The color orange. ordinaryChar(int). Method in class java.io.StreamTokenizer Specifies that the character argument is "ordinary" in this tokenizer. ordinaryChars(int, int). Method in class java.io.StreamTokenizer Specifies that all characters c in the range low <= c <= high are "ordinary" in this tokenizer. origmodel. Variable in class java.awt.image.RGBImageFilter OTHER. Static variable in class java.sql.Types OTHER indicates that the SQL type is database specific and gets mapped to a Java object which can be accessed via getObject and setObject. OTHER_LETTER. Static variable in class java.lang.Character OTHER_NUMBER. Static variable in class java.lang.Character OTHER_PUNCTUATION. Static variable in class java.lang.Character OTHER_SYMBOL. Static variable in class java.lang.Character out. Static variable in class java.io.FileDescriptor A handle to the standard output stream. out. Variable in class java.io.FilterOutputStream

va
379

dil

i.c o

m

380
The underlying output stream. out. Variable in class java.io.FilterWriter The underlying character-output stream. out. Variable in class java.io.PipedInputStream out. Static variable in class java.lang.System The "standard" output stream. OutOfMemoryError(). Constructor for class java.lang.OutOfMemoryError Constructs an OutOfMemoryError with no detail message. OutOfMemoryError(String). Constructor for class java.lang.OutOfMemoryError Constructs an OutOfMemoryError with the specified detail message. outpixbuf. Variable in class java.awt.image.ReplicateScaleFilter OutputStream(). Constructor for class java.io.OutputStream OutputStreamWriter(OutputStream). Constructor for class java.io.OutputStreamWriter Create an OutputStreamWriter that uses the default character encoding. OutputStreamWriter(OutputStream, String). Constructor for class java.io.OutputStreamWriter Create an OutputStreamWriter that uses the named character encoding. owner. Variable in class java.awt.datatransfer.Clipboard

P

ww w. ja

pack(). Method in class java.awt.Window Packs the components of the Window. packagePrefix. Static variable in interface java.rmi.server.LoaderHandler Find loader handler package prefix: assumes that the implementation of the LoaderHandler class is located in the package defined by the prefix. packagePrefix. Static variable in interface java.rmi.server.RemoteRef Find server package prefix: assumes that the implementation of server ref classes (e.g., UnicastRef, UnicastServerRef) are located in the package defined by the prefix. PAINT. Static variable in class java.awt.event.PaintEvent The paint event type. paint(Graphics). Method in class java.awt.Canvas Paints the canvas in the default background color. paint(Graphics). Method in class java.awt.Component Paints the component. paint(Graphics). Method in interface java.awt.peer.ComponentPeer paint(Graphics). Method in class java.awt.Container Paints the container. PAINT_FIRST. Static variable in class java.awt.event.PaintEvent Marks the first integer id for the range of paint event ids. PAINT_LAST. Static variable in class java.awt.event.PaintEvent Marks the last integer id for the range of paint event ids. paintAll(Graphics). Method in class java.awt.Component Paints the component and its subcomponents. paintComponents(Graphics). Method in class java.awt.Container Paints the components in this container. PaintEvent(Component, int, Rectangle). Constructor for class java.awt.event.PaintEvent Constructs a FocusEvent object with the specified source component and type. paintValue(Graphics, Rectangle). Method in interface java.beans.PropertyEditor Paint a representation of the value into a given area of screen real estate. paintValue(Graphics, Rectangle). Method in class java.beans.PropertyEditorSupport Paint a representation of the value into a given area of screen real estate. Panel(). Constructor for class java.awt.Panel Creates a new panel. Panel(LayoutManager). Constructor for class java.awt.Panel Creates a new panel with the specified layout manager. PARAGRAPH_SEPARATOR. Static variable in class java.lang.Character ParameterDescriptor(). Constructor for class java.beans.ParameterDescriptor paramString(). Method in class java.awt.event.ActionEvent paramString(). Method in class java.awt.event.AdjustmentEvent paramString(). Method in class java.awt.AWTEvent paramString(). Method in class java.awt.Button Returns the parameter String of this button. paramString(). Method in class java.awt.Checkbox Returns the parameter String of this Checkbox. paramString(). Method in class java.awt.CheckboxMenuItem Returns the parameter String of this button. paramString(). Method in class java.awt.Choice Returns the parameter String of this Choice. paramString(). Method in class java.awt.Component Returns the parameter String of this Component. paramString(). Method in class java.awt.event.ComponentEvent paramString(). Method in class java.awt.Container Returns the parameter String of this Container. paramString(). Method in class java.awt.event.ContainerEvent

va
380

dil

i.c o

m

381
paramString(). Method in class java.awt.Dialog Returns the parameter String of this Dialog. paramString(). Method in class java.awt.Event Returns the parameter String of this Event. paramString(). Method in class java.awt.FileDialog Returns the parameter String of this file dialog. paramString(). Method in class java.awt.event.FocusEvent paramString(). Method in class java.awt.Frame Returns the parameter String of this Frame. paramString(). Method in class java.awt.event.ItemEvent paramString(). Method in class java.awt.event.KeyEvent paramString(). Method in class java.awt.Label Returns the parameter String of this label. paramString(). Method in class java.awt.List Returns the parameter String of this list. paramString(). Method in class java.awt.Menu Returns the String parameter of the menu. paramString(). Method in class java.awt.MenuComponent Returns the String parameter of this MenuComponent. paramString(). Method in class java.awt.MenuItem Returns the String parameter of the menu item. paramString(). Method in class java.awt.MenuShortcut paramString(). Method in class java.awt.event.MouseEvent paramString(). Method in class java.awt.event.PaintEvent paramString(). Method in class java.awt.Scrollbar Returns the String parameters for this Scrollbar. paramString(). Method in class java.awt.ScrollPane Returns the parameter String of this Container. paramString(). Method in class java.awt.TextArea Returns the String of parameters for this TextArea. paramString(). Method in class java.awt.TextComponent Returns the String of parameters for this TextComponent. paramString(). Method in class java.awt.event.TextEvent paramString(). Method in class java.awt.TextField Returns the String of parameters for this TextField. paramString(). Method in class java.awt.event.WindowEvent parent. Variable in class java.util.ResourceBundle The parent bundle is consulted by getObject when this bundle does not contain a particular resource. parentOf(ThreadGroup). Method in class java.lang.ThreadGroup Tests if this thread group is either the thread group argument or one of its ancestor thread groups. parse(String). Static method in class java.util.Date Given a string representing a time, parse it and return the time value. parse(String). Method in class java.text.DateFormat Parse a date/time string. parse(String). Method in class java.text.MessageFormat Parses the string. parse(String). Method in class java.text.NumberFormat Convenience method. parse(String, ParsePosition). Method in class java.text.ChoiceFormat Returns a Long if possible (e.g. parse(String, ParsePosition). Method in class java.text.DateFormat Parse a date/time string according to the given parse position. parse(String, ParsePosition). Method in class java.text.DecimalFormat Returns a Long if possible (e.g. parse(String, ParsePosition). Method in class java.text.MessageFormat Parses the string. parse(String, ParsePosition). Method in class java.text.NumberFormat Returns a Long if possible (e.g. parse(String, ParsePosition). Method in class java.text.SimpleDateFormat Overrides DateFormat parseByte(String). Static method in class java.lang.Byte Assuming the specified String represents a byte, returns that byte's value. parseByte(String, int). Static method in class java.lang.Byte Assuming the specified String represents a byte, returns that byte's value. ParseException(String, int). Constructor for class java.text.ParseException Constructs a ParseException with the specified detail message and offset. parseInt(String). Static method in class java.lang.Integer Parses the string argument as a signed decimal integer. parseInt(String, int). Static method in class java.lang.Integer Parses the string argument as a signed integer in the radix specified by the second argument. parseLevel(String). Static method in class java.rmi.server.LogStream Convert a string name of a logging level to its internal integer representation. parseLong(String). Static method in class java.lang.Long Parses the string argument as a signed decimal long. parseLong(String, int). Static method in class java.lang.Long Parses the string argument as a signed long in the radix specified by the second argument.

ww w. ja

va
381

dil

i.c o

m

382
parseNumbers(). Method in class java.io.StreamTokenizer Specifies that numbers should be parsed by this tokenizer. parseObject(String). Method in class java.text.Format Parses a string to produce an object. parseObject(String, ParsePosition). Method in class java.text.DateFormat Parse a date/time string into an Object. parseObject(String, ParsePosition). Method in class java.text.Format Parses a string to produce an object. parseObject(String, ParsePosition). Method in class java.text.MessageFormat Parses the string. parseObject(String, ParsePosition). Method in class java.text.NumberFormat Parses a string to produce an object. ParsePosition(int). Constructor for class java.text.ParsePosition Create a new ParsePosition with the given initial index. parseShort(String). Static method in class java.lang.Short Assuming the specified String represents a short, returns that short's value. parseShort(String, int). Static method in class java.lang.Short Assuming the specified String represents a short, returns that short's value. parseURL(URL, String, int, int). Method in class java.net.URLStreamHandler Parses the string representation of a URL into a URL object. pathSeparator. Static variable in class java.io.File The system-dependent path separator string. pathSeparatorChar. Static variable in class java.io.File The system-dependent path separator character. PAUSE. Static variable in class java.awt.Event The Pause action-key. peek(). Method in class java.util.Stack Looks at the object at the top of this stack without removing it from the stack. peek(InetAddress). Method in class java.net.DatagramSocketImpl Peek at the packet to see who it is from. peekEvent(). Method in class java.awt.EventQueue Return the first event without removing it. peekEvent(int). Method in class java.awt.EventQueue permissions(). Method in interface java.security.acl.AclEntry Returns an enumeration of the permissions in this ACL entry. PGDN. Static variable in class java.awt.Event The page down action-key. PGUP. Static variable in class java.awt.Event The page up action-key. PI. Static variable in class java.lang.Math The double value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter. pink. Static variable in class java.awt.Color The color pink. PIPE_SIZE. Static variable in class java.io.PipedInputStream PipedInputStream(). Constructor for class java.io.PipedInputStream Creates a piped input stream that is not yet connected to a piped output stream. PipedInputStream(PipedOutputStream). Constructor for class java.io.PipedInputStream Creates a piped input stream connected to the specified piped output stream. PipedOutputStream(). Constructor for class java.io.PipedOutputStream Creates a piped output stream that is not yet connected to a piped input stream. PipedOutputStream(PipedInputStream). Constructor for class java.io.PipedOutputStream Creates a piped output stream connected to the specified piped input stream. PipedReader(). Constructor for class java.io.PipedReader Create a reader that is not yet connected to a piped writer. PipedReader(PipedWriter). Constructor for class java.io.PipedReader Create a reader for the specified piped character-output stream. PipedWriter(). Constructor for class java.io.PipedWriter Create a writer that is not yet connected to a piped reader. PipedWriter(PipedReader). Constructor for class java.io.PipedWriter Create a writer for the specified piped character-input stream. pixel_bits. Variable in class java.awt.image.ColorModel PixelGrabber(Image, int, int, int, int, boolean). Constructor for class java.awt.image.PixelGrabber Create a PixelGrabber object to grab the (x, y, w, h) rectangular section of pixels from the specified image. PixelGrabber(Image, int, int, int, int, int[], int, int). Constructor for class java.awt.image.PixelGrabber Create a PixelGrabber object to grab the (x, y, w, h) rectangular section of pixels from the specified image into the given array. PixelGrabber(ImageProducer, int, int, int, int, int[], int, int). Constructor for class java.awt.image.PixelGrabber Create a PixelGrabber object to grab the (x, y, w, h) rectangular section of pixels from the image produced by the specified ImageProducer into the given array. PLAIN. Static variable in class java.awt.Font The plain style constant. plainTextFlavor. Static variable in class java.awt.datatransfer.DataFlavor The DataFlavor representing plain text with unicode encoding, where: representationClass = InputStream mimeType = "text/plain; charset=unicode"

ww w. ja

va
382

dil

i.c o

m

383

ww w. ja

play(). Method in interface java.applet.AudioClip Starts playing this audio clip. play(URL). Method in class java.applet.Applet Plays the audio clip at the specified absolute URL. play(URL, String). Method in class java.applet.Applet Plays the audio clip given the URL and a specifier that is relative to it. PM. Static variable in class java.util.Calendar Useful constant for hour in 12-hour clock. Point(). Constructor for class java.awt.Point Constructs and initializes a Point initialized with (0, 0). Point(int, int). Constructor for class java.awt.Point Constructs and initializes a Point from the specified x and y coordinates. Point(Point). Constructor for class java.awt.Point Constructs and initializes a Point with the same location as the specified Point. Polygon(). Constructor for class java.awt.Polygon Creates an empty polygon. Polygon(int[], int[], int). Constructor for class java.awt.Polygon Constructs and initializes a Polygon from the specified parameters. pop(). Method in class java.util.Stack Removes the object at the top of this stack and returns that object as the value of this function. PopupMenu(). Constructor for class java.awt.PopupMenu Creates a new popup menu. PopupMenu(String). Constructor for class java.awt.PopupMenu Creates a new popup menu with the specified name. port. Variable in class java.net.SocketImpl The port number on the remote host to which this socket is connected. pos. Variable in class java.io.BufferedInputStream The current position in the buffer. pos. Variable in class java.io.ByteArrayInputStream The index of the next character to read from the input stream buffer. pos. Variable in class java.io.CharArrayReader Current buffer position pos. Variable in class java.io.PushbackInputStream The current position within the buffer. pos. Variable in class java.io.StringBufferInputStream The index of the next character to read from the input stream buffer. POSITIVE_INFINITY. Static variable in class java.lang.Double The positive infinity of type double. POSITIVE_INFINITY. Static variable in class java.lang.Float The positive infinity of type float. postEvent(AWTEvent). Method in class java.awt.EventQueue Post a 1.1-style event to the EventQueue. postEvent(Event). Method in class java.awt.Component postEvent(Event). Method in class java.awt.MenuComponent Posts the specified event to the menu. postEvent(Event). Method in interface java.awt.MenuContainer postEvent(Event). Method in class java.awt.Window pow(double, double). Static method in class java.lang.Math Returns of value of the first argument raised to the power of the second argument. pow(int). Method in class java.math.BigInteger Returns a BigInteger whose value is (this ** exponent). PRC. Static variable in class java.util.Locale Useful constant for country. predefined. Static variable in class java.awt.Cursor preferredLayoutSize(Container). Method in class java.awt.BorderLayout Returns the preferred dimensions for this layout given the components in the specified target container. preferredLayoutSize(Container). Method in class java.awt.CardLayout Calculates the preferred size for the specified panel. preferredLayoutSize(Container). Method in class java.awt.FlowLayout Returns the preferred dimensions for this layout given the components in the specified target container. preferredLayoutSize(Container). Method in class java.awt.GridBagLayout Returns the preferred dimensions for this layout given the components in the specified panel. preferredLayoutSize(Container). Method in class java.awt.GridLayout Returns the preferred dimensions for this layout given the components int the specified panel. preferredLayoutSize(Container). Method in interface java.awt.LayoutManager Calculates the preferred size dimensions for the specified panel given the components in the specified parent container. PREFERREDSIZE. Static variable in class java.awt.GridBagLayout preferredSize(). Method in class java.awt.Component preferredSize(). Method in interface java.awt.peer.ComponentPeer DEPRECATED: Replaced by getPreferredSize(). preferredSize(). Method in class java.awt.Container preferredSize(). Method in class java.awt.List preferredSize(). Method in class java.awt.TextArea preferredSize(). Method in class java.awt.TextField preferredSize(int). Method in class java.awt.List

va
383

dil

i.c o

m

384
preferredSize(int). Method in interface java.awt.peer.ListPeer DEPRECATED: Replaced by getPreferredSize(int). preferredSize(int). Method in class java.awt.TextField preferredSize(int). Method in interface java.awt.peer.TextFieldPeer DEPRECATED: Replaced by getPreferredSize(int). preferredSize(int, int). Method in class java.awt.TextArea preferredSize(int, int). Method in interface java.awt.peer.TextAreaPeer DEPRECATED: Replaced by getPreferredSize(int, int). prepareCall(String). Method in interface java.sql.Connection A SQL stored procedure call statement is handled by creating a CallableStatement for it. prepareImage(Image, ImageObserver). Method in class java.awt.Component Prepares an image for rendering on this Component. prepareImage(Image, int, int, ImageObserver). Method in class java.awt.Component Prepares an image for rendering on this Component at the specified width and height. prepareImage(Image, int, int, ImageObserver). Method in interface java.awt.peer.ComponentPeer prepareImage(Image, int, int, ImageObserver). Method in class java.awt.Toolkit Prepares an image for rendering on the default screen at the specified width and height. prepareStatement(String). Method in interface java.sql.Connection A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object. previous(). Method in class java.text.BreakIterator Return the boundary preceding the current boundary. previous(). Method in interface java.text.CharacterIterator Decrement the iterator's index by one and return the character at the new index. previous(). Method in class java.text.StringCharacterIterator Decrement the iterator's index by one and return the character at the new index. previous(Container). Method in class java.awt.CardLayout Flips to the previous card of the specified container. previousDouble(double). Static method in class java.text.ChoiceFormat Finds the greatest double less than d. PRIMARY. Static variable in class java.text.Collator Collator strength value. primaryOrder(int). Static method in class java.text.CollationElementIterator Get the primary order of a collation order. print(boolean). Method in class java.io.PrintStream Prints the string "true" to the underlying output stream if the value of the boolean argument is true; otherwise, prints the string "false" to the underlying output stream. print(boolean). Method in class java.io.PrintWriter Print a boolean. print(char). Method in class java.io.PrintStream Prints the low eight bits of the character argument to this print stream's underlying output stream. print(char). Method in class java.io.PrintWriter Print a character. print(char[]). Method in class java.io.PrintStream Prints the low eight bits of each of the characters in the character array to this print stream's underlying output stream. print(char[]). Method in class java.io.PrintWriter Print an array of chracters. print(double). Method in class java.io.PrintStream Prints the string representation of the double to this print stream's underlying output stream. print(double). Method in class java.io.PrintWriter Print a double. print(float). Method in class java.io.PrintStream Prints the string representation of the float to this print stream's underlying output stream. print(float). Method in class java.io.PrintWriter Print a float. print(Graphics). Method in class java.awt.Component Prints this component. print(Graphics). Method in interface java.awt.peer.ComponentPeer print(Graphics). Method in class java.awt.Container Prints the container. print(int). Method in class java.io.PrintStream Prints the string representation of the int to this print stream's underlying output stream. print(int). Method in class java.io.PrintWriter Print an integer. print(long). Method in class java.io.PrintStream Prints the string representation of the long to this print stream's underlying output stream. print(long). Method in class java.io.PrintWriter Print a long. print(Object). Method in class java.io.PrintStream Prints the string representation of the Object to this print stream's underlying output stream. print(Object). Method in class java.io.PrintWriter Print an object. print(String). Method in class java.io.PrintStream If the string argument is null, the string "null" is printed to this print stream's underlying output stream. print(String). Method in class java.io.PrintWriter Print a String. PRINT_SCREEN. Static variable in class java.awt.Event

ww w. ja

va
384

dil

i.c o

m

385
The PrintScreen action-key. printAll(Graphics). Method in class java.awt.Component Prints the component and its subcomponents. printComponents(Graphics). Method in class java.awt.Container Prints the components in this container. printComponents(Graphics). Method in class java.awt.ScrollPane Prints the component in this scroll pane. PrintJob(). Constructor for class java.awt.PrintJob println(). Method in class java.io.PrintStream Prints a newline character to this print stream's underlying output stream. println(). Method in class java.io.PrintWriter Finish the line. println(boolean). Method in class java.io.PrintStream Prints the string "true" followed by a newline character to this print stream's underlying output stream if the value of the boolean argument is true; otherwise prints the string "false" followed by a newline character to the underlying output stream. println(boolean). Method in class java.io.PrintWriter Print a boolean, and then finish the line. println(char). Method in class java.io.PrintStream Prints the low eight bits of the character argument followed by a newline character to this print stream's underlying output stream. println(char). Method in class java.io.PrintWriter Print a character, and then finish the line. println(char[]). Method in class java.io.PrintStream Prints the low eight bits of each of the characters in the character array, followed by a newline character, to this print stream's underlying output stream. println(char[]). Method in class java.io.PrintWriter Print an array of characters, and then finish the line. println(double). Method in class java.io.PrintStream Prints the string representation of the double followed by a newline to this print stream's underlying output stream. println(double). Method in class java.io.PrintWriter Print a double, and then finish the line. println(float). Method in class java.io.PrintStream Prints the string representation of the float followed by a newline to this print stream's underlying output stream. println(float). Method in class java.io.PrintWriter Print a float, and then finish the line. println(int). Method in class java.io.PrintStream Prints the string representation of the int followed by a newline to this print stream's underlying output stream. println(int). Method in class java.io.PrintWriter Print an integer, and then finish the line. println(long). Method in class java.io.PrintStream Prints the string representation of the long followed by a newline to this print stream's underlying output stream. println(long). Method in class java.io.PrintWriter Print a long, and then finish the line. println(Object). Method in class java.io.PrintStream Prints the string representation of the Object followed by a newline to this print stream's underlying output stream. println(Object). Method in class java.io.PrintWriter Print an Object, and then finish the line. println(String). Static method in class java.sql.DriverManager Print a message to the current JDBC log stream println(String). Method in class java.io.PrintStream If the string argument is null, the string "null" followed by a newline character is printed to this print stream's underlying output stream. println(String). Method in class java.io.PrintWriter Print a String, and then finish the line. printStackTrace(). Method in class java.lang.Throwable Prints this Throwable and its backtrace to the standard error stream. printStackTrace(PrintStream). Method in class java.lang.Throwable Prints this Throwable and its backtrace to the specified print stream. printStackTrace(PrintWriter). Method in class java.lang.Throwable Prints this Throwable and its backtrace to the specified print writer. PrintStream(OutputStream). Constructor for class java.io.PrintStream Constructs a new print stream that writes its output to the specified underlying output stream. PrintStream(OutputStream, boolean). Constructor for class java.io.PrintStream Constructs a new print stream that writes its output to the specified underlying output stream. printToConsole(String). Method in interface sun.tools.debug.DebuggerCallback Print text to the debugger's console window. PrintWriter(OutputStream). Constructor for class java.io.PrintWriter Create a new PrintWriter, without automatic line flushing, from an existing OutputStream. PrintWriter(OutputStream, boolean). Constructor for class java.io.PrintWriter Create a new PrintWriter from an existing OutputStream. PrintWriter(Writer). Constructor for class java.io.PrintWriter Create a new PrintWriter, without automatic line flushing. PrintWriter(Writer, boolean). Constructor for class java.io.PrintWriter Create a new PrintWriter. PRIVATE. Static variable in class java.lang.reflect.Modifier

ww w. ja

va
385

dil

i.c o

m

386
PRIVATE_USE. Static variable in class java.lang.Character procedureColumnIn. Static variable in interface java.sql.DatabaseMetaData COLUMN_TYPE - IN parameter. procedureColumnInOut. Static variable in interface java.sql.DatabaseMetaData COLUMN_TYPE - INOUT parameter. procedureColumnOut. Static variable in interface java.sql.DatabaseMetaData COLUMN_TYPE - OUT parameter. procedureColumnResult. Static variable in interface java.sql.DatabaseMetaData COLUMN_TYPE - result column in ResultSet. procedureColumnReturn. Static variable in interface java.sql.DatabaseMetaData COLUMN_TYPE - procedure return value. procedureColumnUnknown. Static variable in interface java.sql.DatabaseMetaData COLUMN_TYPE - nobody knows. procedureNoNulls. Static variable in interface java.sql.DatabaseMetaData TYPE NULLABLE - does not allow NULL values. procedureNoResult. Static variable in interface java.sql.DatabaseMetaData PROCEDURE_TYPE - Does not return a result. procedureNullable. Static variable in interface java.sql.DatabaseMetaData TYPE NULLABLE - allows NULL values. procedureNullableUnknown. Static variable in interface java.sql.DatabaseMetaData TYPE NULLABLE - nullability unknown. procedureResultUnknown. Static variable in interface java.sql.DatabaseMetaData PROCEDURE_TYPE - May return a result. procedureReturnsResult. Static variable in interface java.sql.DatabaseMetaData PROCEDURE_TYPE - Returns a result. Process(). Constructor for class java.lang.Process processActionEvent(ActionEvent). Method in class java.awt.Button Processes action events occurring on this button by dispatching them to any registered ActionListener objects. processActionEvent(ActionEvent). Method in class java.awt.List Processes action events occurring on this component by dispatching them to any registered ActionListener objects. processActionEvent(ActionEvent). Method in class java.awt.MenuItem Processes action events occurring on this menu item by dispatching them to any registered ActionListener objects. processActionEvent(ActionEvent). Method in class java.awt.TextField Processes action events occurring on this textfield by dispatching them to any registered ActionListener objects. processAdjustmentEvent(AdjustmentEvent). Method in class java.awt.Scrollbar Processes adjustment events occurring on this scrollbar by dispatching them to any registered AdjustmentListener objects. processComponentEvent(ComponentEvent). Method in class java.awt.Component Processes component events occurring on this component by dispatching them to any registered ComponentListener objects. processContainerEvent(ContainerEvent). Method in class java.awt.Container Processes container events occurring on this container by dispatching them to any registered ContainerListener objects. processEvent(AWTEvent). Method in class java.awt.Button Processes events on this button. processEvent(AWTEvent). Method in class java.awt.Checkbox Processes events on this checkbox. processEvent(AWTEvent). Method in class java.awt.CheckboxMenuItem Processes events on this checkbox menu item. processEvent(AWTEvent). Method in class java.awt.Choice Processes events on this choice. processEvent(AWTEvent). Method in class java.awt.Component Processes events occurring on this component. processEvent(AWTEvent). Method in class java.awt.Container Processes events on this container. processEvent(AWTEvent). Method in class java.awt.List Processes events on this list. processEvent(AWTEvent). Method in class java.awt.MenuComponent Processes events occurring on this menu component. processEvent(AWTEvent). Method in class java.awt.MenuItem Processes events on this menu item. processEvent(AWTEvent). Method in class java.awt.Scrollbar Processes events on this scrollbar. processEvent(AWTEvent). Method in class java.awt.TextComponent Processes events on this textcomponent. processEvent(AWTEvent). Method in class java.awt.TextField Processes events on this textfield. processEvent(AWTEvent). Method in class java.awt.Window Processes events on this window. processFocusEvent(FocusEvent). Method in class java.awt.Component Processes focus events occurring on this component by dispatching them to any registered FocusListener objects. processItemEvent(ItemEvent). Method in class java.awt.Checkbox Processes item events occurring on this checkbox by dispatching them to any registered ItemListener objects. processItemEvent(ItemEvent). Method in class java.awt.CheckboxMenuItem Processes item events occurring on this checkbox menu item by dispatching them to any registered ItemListener objects. processItemEvent(ItemEvent). Method in class java.awt.Choice Processes item events occurring on this choice by dispatching them to any registered ItemListener objects. processItemEvent(ItemEvent). Method in class java.awt.List Processes item events occurring on this list by dispatching them to any registered ItemListener objects.

ww w. ja

va
386

dil

i.c o

m

387
processKeyEvent(KeyEvent). Method in class java.awt.Component Processes key events occurring on this component by dispatching them to any registered KeyListener objects. processMouseEvent(MouseEvent). Method in class java.awt.Component Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects. processMouseMotionEvent(MouseEvent). Method in class java.awt.Component Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListener objects. processTextEvent(TextEvent). Method in class java.awt.TextComponent Processes text events occurring on this text component by dispatching them to any registered TextListener objects. processWindowEvent(WindowEvent). Method in class java.awt.Window Processes window events occurring on this window by dispatching them to any registered WindowListener objects. PROPERTIES. Static variable in interface java.awt.image.ImageObserver The properties of the image are now available. Properties(). Constructor for class java.util.Properties Creates an empty property list with no default values. Properties(Properties). Constructor for class java.util.Properties Creates an empty property list with the specified defaults. propertyChange(PropertyChangeEvent). Method in interface java.beans.PropertyChangeListener This method gets called when a bound property is changed. PropertyChangeEvent(Object, String, Object, Object). Constructor for class java.beans.PropertyChangeEvent PropertyChangeSupport(Object). Constructor for class java.beans.PropertyChangeSupport PropertyDescriptor(String, Class). Constructor for class java.beans.PropertyDescriptor Constructs a PropertyDescriptor for a property that follows the standard Java convention by having getFoo and setFoo accessor methods. PropertyDescriptor(String, Class, String, String). Constructor for class java.beans.PropertyDescriptor This constructor takes the name of a simple property, and method names for reading and writing the property. PropertyDescriptor(String, Method, Method). Constructor for class java.beans.PropertyDescriptor This constructor takes the name of a simple property, and Method objects for reading and writing the property. PropertyEditorManager(). Constructor for class java.beans.PropertyEditorManager PropertyEditorSupport(). Constructor for class java.beans.PropertyEditorSupport Constructor for use by derived PropertyEditor classes. PropertyEditorSupport(Object). Constructor for class java.beans.PropertyEditorSupport Constructor for use when a PropertyEditor is delegating to us. propertyNames(). Method in class java.util.Properties Returns an enumeration of all the keys in this property list, including the keys in the default property list. PropertyResourceBundle(InputStream). Constructor for class java.util.PropertyResourceBundle Creates a property resource PropertyVetoException(String, PropertyChangeEvent). Constructor for class java.beans.PropertyVetoException PROTECTED. Static variable in class java.lang.reflect.Modifier ProtocolException(). Constructor for class java.net.ProtocolException Constructs a new ProtocolException with no detail message. ProtocolException(String). Constructor for class java.net.ProtocolException Constructs a new ProtocolException with the specified detail message. Provider(String, double, String). Constructor for class java.security.Provider Constructs a provider with the specified name, version number, and information. ProviderException(). Constructor for class java.security.ProviderException Constructs a ProviderException with no detail message. ProviderException(String). Constructor for class java.security.ProviderException Constructs a ProviderException with the specified detail message. PUBLIC. Static variable in interface java.lang.reflect.Member Identifies the set of all public members of a class or interface, including inherited members. PUBLIC. Static variable in class java.lang.reflect.Modifier push(Object). Method in class java.util.Stack Pushes an item onto the top of this stack. pushBack(). Method in class java.io.StreamTokenizer Causes the next call to the nextToken method of this tokenizer to return the current value in the ttype field, and not to modify the value in the nval or sval field. PushbackInputStream(InputStream). Constructor for class java.io.PushbackInputStream Constructs a new pushback input stream that reads its input from the specified input stream. PushbackInputStream(InputStream, int). Constructor for class java.io.PushbackInputStream Creates a new input stream with a push back buffer of specified size. PushbackReader(Reader). Constructor for class java.io.PushbackReader Create a new pushback reader with a one-character pushback buffer. PushbackReader(Reader, int). Constructor for class java.io.PushbackReader Create a new pushback reader with a pushback buffer of the given size. put(Object, Object). Method in class java.util.Dictionary Maps the specified key to the specified value in this dictionary. put(Object, Object). Method in class java.util.Hashtable Maps the specified key to the specified value in this hashtable. putNextEntry(ZipEntry). Method in class java.util.zip.ZipOutputStream Begins writing a new ZIP file entry and positions the stream to the start of the entry data.

ww w. ja
Q

va
387

dil

i.c o

m

388
quitEvent(). Method in interface sun.tools.debug.DebuggerCallback The client interpreter has exited, either by returning from its main thread, or by calling System.exit(). quoteChar(int). Method in class java.io.StreamTokenizer Specifies that matching pairs of this character delimit string constants in this tokenizer.

R

ww w. ja

random(). Static method in class java.lang.Math Returns a random number between 0.0 and 1.0. Random(). Constructor for class java.util.Random Creates a new random number generator. Random(long). Constructor for class java.util.Random Creates a new random number generator using a single long seed. RandomAccessFile(File, String). Constructor for class java.io.RandomAccessFile Creates a random access file stream to read from, and optionally to write to, the file specified by the File argument. RandomAccessFile(String, String). Constructor for class java.io.RandomAccessFile Creates a random access file stream to read from, and optionally to write to, a file with the specified name. RANDOMPIXELORDER. Static variable in interface java.awt.image.ImageConsumer The pixels will be delivered in a random order. read(). Method in class java.io.BufferedInputStream Reads the next byte of data from this buffered input stream. read(). Method in class java.io.BufferedReader Read a single character. read(). Method in class java.io.ByteArrayInputStream Reads the next byte of data from this input stream. read(). Method in class java.io.CharArrayReader Read a single character. read(). Method in class java.util.zip.CheckedInputStream Reads a byte. read(). Method in class java.security.DigestInputStream Reads a byte, and updates the message digest (if the digest function is on). read(). Method in class java.io.FileInputStream Reads a byte of data from this input stream. read(). Method in class java.io.FilterInputStream Reads the next byte of data from this input stream. read(). Method in class java.io.FilterReader Read a single character. read(). Method in class java.util.zip.InflaterInputStream Reads a byte of uncompressed data. read(). Method in class java.io.InputStream Reads the next byte of data from this input stream. read(). Method in class java.io.InputStreamReader Read a single character. read(). Method in class java.io.LineNumberInputStream Reads the next byte of data from this input stream. read(). Method in class java.io.LineNumberReader Read a single character. read(). Method in interface java.io.ObjectInput Reads a byte of data. read(). Method in class java.io.ObjectInputStream Reads a byte of data. read(). Method in class java.io.PipedInputStream Reads the next byte of data from this piped input stream. read(). Method in class java.io.PushbackInputStream Reads the next byte of data from this input stream. read(). Method in class java.io.PushbackReader Read a single character. read(). Method in class java.io.RandomAccessFile Reads a byte of data from this file. read(). Method in class java.io.Reader Read a single character. read(). Method in class java.io.SequenceInputStream Reads the next byte of data from this input stream. read(). Method in class java.io.StringBufferInputStream Reads the next byte of data from this input stream. read(). Method in class java.io.StringReader Read a single character. read(byte[]). Method in class java.io.DataInputStream Reads up to byte.length bytes of data from this data input stream into an array of bytes. read(byte[]). Method in class java.io.FileInputStream Reads up to b.length bytes of data from this input stream into an array of bytes. read(byte[]). Method in class java.io.FilterInputStream Reads up to byte.length bytes of data from this input stream into an array of bytes. read(byte[]). Method in class java.io.InputStream

va
388

dil

i.c o

m

389
Reads up to b.length bytes of data from this input stream into an array of bytes. read(byte[]). Method in interface java.io.ObjectInput Reads into an array of bytes. read(byte[]). Method in class java.io.RandomAccessFile Reads up to b.length bytes of data from this file into an array of bytes. read(byte[], int, int). Method in class java.io.BufferedInputStream Reads up to len bytes of data from this buffered input stream into an array of bytes. read(byte[], int, int). Method in class java.io.ByteArrayInputStream Reads up to len bytes of data into an array of bytes from this input stream. read(byte[], int, int). Method in class java.util.zip.CheckedInputStream Reads into an array of bytes. read(byte[], int, int). Method in class java.io.DataInputStream Reads up to len bytes of data from this data input stream into an array of bytes. read(byte[], int, int). Method in class java.security.DigestInputStream Reads into a byte array, and updates the message digest (if the digest function is on). read(byte[], int, int). Method in class java.io.FileInputStream Reads up to len bytes of data from this input stream into an array of bytes. read(byte[], int, int). Method in class java.io.FilterInputStream Reads up to len bytes of data from this input stream into an array of bytes. read(byte[], int, int). Method in class java.util.zip.GZIPInputStream Reads uncompressed data into an array of bytes. read(byte[], int, int). Method in class java.util.zip.InflaterInputStream Reads uncompressed data into an array of bytes. read(byte[], int, int). Method in class java.io.InputStream Reads up to len bytes of data from this input stream into an array of bytes. read(byte[], int, int). Method in class java.io.LineNumberInputStream Reads up to len bytes of data from this input stream into an array of bytes. read(byte[], int, int). Method in interface java.io.ObjectInput Reads into an array of bytes. read(byte[], int, int). Method in class java.io.ObjectInputStream Reads into an array of bytes. read(byte[], int, int). Method in class java.io.PipedInputStream Reads up to len bytes of data from this piped input stream into an array of bytes. read(byte[], int, int). Method in class java.io.PushbackInputStream Reads up to len bytes of data from this input stream into an array of bytes. read(byte[], int, int). Method in class java.io.RandomAccessFile Reads up to len bytes of data from this file into an array of bytes. read(byte[], int, int). Method in class java.io.SequenceInputStream Reads up to len bytes of data from this input stream into an array of bytes. read(byte[], int, int). Method in class java.io.StringBufferInputStream Reads up to len bytes of data from this input stream into an array of bytes. read(byte[], int, int). Method in class java.util.zip.ZipInputStream Reads from the current ZIP entry into an array of bytes. read(char[]). Method in class java.io.Reader Read characters into an array. read(char[], int, int). Method in class java.io.BufferedReader Read characters into a portion of an array. read(char[], int, int). Method in class java.io.CharArrayReader Read characters into a portion of an array. read(char[], int, int). Method in class java.io.FilterReader Read characters into a portion of an array. read(char[], int, int). Method in class java.io.InputStreamReader Read characters into a portion of an array. read(char[], int, int). Method in class java.io.LineNumberReader Read characters into a portion of an array. read(char[], int, int). Method in class java.io.PipedReader Read characters into a portion of an array. read(char[], int, int). Method in class java.io.PushbackReader Read characters into a portion of an array. read(char[], int, int). Method in class java.io.Reader Read characters into a portion of an array. read(char[], int, int). Method in class java.io.StringReader Read characters into a portion of an array. read(DataInput). Static method in class java.rmi.server.UID Get the uid from the input stream. read(ObjectInput). Static method in class java.rmi.server.ObjID The read method constructs an object id whose contents is read from the specified input stream. readBoolean(). Method in interface java.io.DataInput Reads a boolean value from the input stream. readBoolean(). Method in class java.io.DataInputStream Reads a boolean from this data input stream. readBoolean(). Method in class java.io.ObjectInputStream Reads in a boolean. readBoolean(). Method in class java.io.RandomAccessFile Reads a boolean from this file. readByte(). Method in interface java.io.DataInput

ww w. ja

va
389

dil

i.c o

m

390
Reads a signed 8-bit value from the input stream. readByte(). Method in class java.io.DataInputStream Reads a signed 8-bit value from this data input stream. readByte(). Method in class java.io.ObjectInputStream Reads an 8 bit byte. readByte(). Method in class java.io.RandomAccessFile Reads a signed 8-bit value from this file. readChar(). Method in interface java.io.DataInput Reads a Unicode char value from the input stream. readChar(). Method in class java.io.DataInputStream Reads a Unicode character from this data input stream. readChar(). Method in class java.io.ObjectInputStream Reads a 16 bit char. readChar(). Method in class java.io.RandomAccessFile Reads a Unicode character from this file. readDouble(). Method in interface java.io.DataInput Reads a double value from the input stream. readDouble(). Method in class java.io.DataInputStream Reads a double from this data input stream. readDouble(). Method in class java.io.ObjectInputStream Reads a 64 bit double. readDouble(). Method in class java.io.RandomAccessFile Reads a double from this file. Reader(). Constructor for class java.io.Reader Create a new character-stream reader whose critical sections will synchronize on the reader itself. Reader(Object). Constructor for class java.io.Reader Create a new character-stream reader whose critical sections will synchronize on the given object. readExternal(ObjectInput). Method in interface java.io.Externalizable The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. readFloat(). Method in interface java.io.DataInput Reads a float value from the input stream. readFloat(). Method in class java.io.DataInputStream Reads a float from this data input stream. readFloat(). Method in class java.io.ObjectInputStream Reads a 32 bit float. readFloat(). Method in class java.io.RandomAccessFile Reads a float from this file. readFully(byte[]). Method in interface java.io.DataInput Reads b.length bytes into the byte array. readFully(byte[]). Method in class java.io.DataInputStream Reads b.length bytes from this data input stream into the byte array. readFully(byte[]). Method in class java.io.ObjectInputStream Reads bytes, blocking until all bytes are read. readFully(byte[]). Method in class java.io.RandomAccessFile Reads b.length bytes from this file into the byte array. readFully(byte[], int, int). Method in interface java.io.DataInput Reads b.length bytes into the byte array. readFully(byte[], int, int). Method in class java.io.DataInputStream Reads exactly len bytes from this data input stream into the byte array. readFully(byte[], int, int). Method in class java.io.ObjectInputStream Reads bytes, blocking until all bytes are read. readFully(byte[], int, int). Method in class java.io.RandomAccessFile Reads exactly len bytes from this file into the byte array. readInt(). Method in interface java.io.DataInput Reads an int value from the input stream. readInt(). Method in class java.io.DataInputStream Reads a signed 32-bit integer from this data input stream. readInt(). Method in class java.io.ObjectInputStream Reads a 32 bit int. readInt(). Method in class java.io.RandomAccessFile Reads a signed 32-bit integer from this file. readLine(). Method in class java.io.BufferedReader Read a line of text. readLine(). Method in interface java.io.DataInput Reads the next line of text from the input stream. readLine(). Method in class java.io.DataInputStream Reads the next line of text from this data input stream. readLine(). Method in class java.io.LineNumberReader Read a line of text. readLine(). Method in class java.io.ObjectInputStream Reads in a line that has been terminated by a \n, \r, \r\n or EOF. readLine(). Method in class java.io.RandomAccessFile Reads the next line of text from this file. readLong(). Method in interface java.io.DataInput Reads a long value from the input stream.

ww w. ja

va
390

dil

i.c o

m

391
readLong(). Method in class java.io.DataInputStream Reads a signed 64-bit integer from this data input stream. readLong(). Method in class java.io.ObjectInputStream Reads a 64 bit long. readLong(). Method in class java.io.RandomAccessFile Reads a signed 64-bit integer from this file. readObject(). Method in interface java.io.ObjectInput Read and return an object. readObject(). Method in class java.io.ObjectInputStream Read an object from the ObjectInputStream. readShort(). Method in interface java.io.DataInput Reads a 16-bit value from the input stream. readShort(). Method in class java.io.DataInputStream Reads a signed 16-bit number from this data input stream. readShort(). Method in class java.io.ObjectInputStream Reads a 16 bit short. readShort(). Method in class java.io.RandomAccessFile Reads a signed 16-bit number from this file. readStreamHeader(). Method in class java.io.ObjectInputStream The readStreamHeader method is provided to allow subclasses to read and verify their own stream headers. readUnsignedByte(). Method in interface java.io.DataInput Reads an unsigned 8-bit value from the input stream. readUnsignedByte(). Method in class java.io.DataInputStream Reads an unsigned 8-bit number from this data input stream. readUnsignedByte(). Method in class java.io.ObjectInputStream Reads an unsigned 8 bit byte. readUnsignedByte(). Method in class java.io.RandomAccessFile Reads an unsigned 8-bit number from this file. readUnsignedShort(). Method in interface java.io.DataInput Reads an unsigned 16-bit value from the input stream. readUnsignedShort(). Method in class java.io.DataInputStream Reads an unsigned 16-bit number from this data input stream. readUnsignedShort(). Method in class java.io.ObjectInputStream Reads an unsigned 16 bit short. readUnsignedShort(). Method in class java.io.RandomAccessFile Reads an unsigned 16-bit number from this file. readUTF(). Method in interface java.io.DataInput Reads in a string that has been encoded using a modified UTF-8 format. readUTF(). Method in class java.io.DataInputStream Reads in a string that has been encoded using a modified UTF-8 format from this data input stream. readUTF(). Method in class java.io.ObjectInputStream Reads a UTF format String. readUTF(). Method in class java.io.RandomAccessFile Reads in a string from this file. readUTF(DataInput). Static method in class java.io.DataInputStream Reads in a string from the specified data input stream. ready(). Method in class java.io.BufferedReader Tell whether this stream is ready to be read. ready(). Method in class java.io.CharArrayReader Tell whether this stream is ready to be read. ready(). Method in class java.io.FilterReader Tell whether this stream is ready to be read. ready(). Method in class java.io.InputStreamReader Tell whether this stream is ready to be read. ready(). Method in class java.io.PushbackReader Tell whether this stream is ready to be read. ready(). Method in class java.io.Reader Tell whether this stream is ready to be read. ready(). Method in class java.io.StringReader Tell whether this stream is ready to be read. REAL. Static variable in class java.sql.Types rebind(String, Remote). Static method in class java.rmi.Naming Rebind the name to a new object; replaces any existing binding. rebind(String, Remote). Method in interface java.rmi.registry.Registry Rebind the name to a new object, replacing any existing binding. receive(DatagramPacket). Method in class java.net.DatagramSocket Receives a datagram packet from this socket. receive(DatagramPacket). Method in class java.net.DatagramSocketImpl Receive the datagram packet. receive(int). Method in class java.io.PipedInputStream Receives a byte of data. Rectangle(). Constructor for class java.awt.Rectangle Constructs a new rectangle, initialized to location (0, 0) and size (0, 0). Rectangle(Dimension). Constructor for class java.awt.Rectangle Constructs a rectangle and initializes it to the specified width and height. Rectangle(int, int). Constructor for class java.awt.Rectangle

ww w. ja

va
391

dil

i.c o

m

392
Constructs a rectangle and initializes it with the specified width and height parameters. Rectangle(int, int, int, int). Constructor for class java.awt.Rectangle Constructs and initializes a rectangle with the specified parameters. Rectangle(Point). Constructor for class java.awt.Rectangle Constructs a rectangle and initializes it to the specified point. Rectangle(Point, Dimension). Constructor for class java.awt.Rectangle Constructs a rectangle and initializes it to a specified point and dimension. Rectangle(Rectangle). Constructor for class java.awt.Rectangle Constructs a new rectangle, initialized to match the values of the specificed rectangle. red. Static variable in class java.awt.Color The color red. ref. Variable in class java.rmi.server.RemoteObject regionMatches(boolean, int, String, int, int). Method in class java.lang.String Tests if two string regions are equal. regionMatches(int, String, int, int). Method in class java.lang.String Tests if two string regions are equal. registerDriver(Driver). Static method in class java.sql.DriverManager A newly loaded driver class should call registerDriver to make itself known to the DriverManager. registerEditor(Class, Class). Static method in class java.beans.PropertyEditorManager Register an editor class to be used to editor values of a given target class. registerOutParameter(int, int). Method in interface java.sql.CallableStatement Before executing a stored procedure call, you must explicitly call registerOutParameter to register the java.sql.Type of each out parameter. registerOutParameter(int, int, int). Method in interface java.sql.CallableStatement Use this version of registerOutParameter for registering Numeric or Decimal out parameters. registerValidation(ObjectInputValidation, int). Method in class java.io.ObjectInputStream Register an object to be validated before the graph is returned. REGISTRY_ID. Static variable in class java.rmi.server.ObjID well-known id for the registry REGISTRY_PORT. Static variable in interface java.rmi.registry.Registry Well known port for registry registryImpl(int). Method in interface java.rmi.registry.RegistryHandler Constructs and exports a Registry on the specified port. registryStub(String, int). Method in interface java.rmi.registry.RegistryHandler Returns a "stub" for contacting a remote registry on the specified host and port. rehash(). Method in class java.util.Hashtable Rehashes the contents of the hashtable into a hashtable with a larger capacity. RELATIVE. Static variable in class java.awt.GridBagConstraints releaseInputStream(). Method in interface java.rmi.server.RemoteCall Release the input stream. releaseOutputStream(). Method in interface java.rmi.server.RemoteCall Release the output stream; in some transports this would release the stream. REMAINDER. Static variable in class java.awt.GridBagConstraints remainder(BigInteger). Method in class java.math.BigInteger Returns a BigInteger whose value is (this % val). RemoteDebugger(String, DebuggerCallback, boolean). Constructor for class sun.tools.debug.RemoteDebugger Create a remote debugger. RemoteDebugger(String, String, DebuggerCallback, boolean). Constructor for class sun.tools.debug.RemoteDebugger Create a remote debugger, connecting it with a running Java interpreter. To connect to a running interpreter, it must be started with the "-debug" option, whereupon it will print out the password for that debugging session. remoteEquals(RemoteRef). Method in interface java.rmi.server.RemoteRef Compares two remote objects for equality. RemoteException(). Constructor for class java.rmi.RemoteException Create a remote exception RemoteException(String). Constructor for class java.rmi.RemoteException Create a remote exception with the specified string RemoteException(String, Throwable). Constructor for class java.rmi.RemoteException Create a remote exception with the specified string, and the exception specified. remoteHashCode(). Method in interface java.rmi.server.RemoteRef Returns a hashcode for a remote object. RemoteInt(int). Constructor for class sun.tools.debug.RemoteInt RemoteObject(). Constructor for class java.rmi.server.RemoteObject Create a remote object. RemoteObject(RemoteRef). Constructor for class java.rmi.server.RemoteObject Create a remote object, initialized with the specified remote reference. RemoteServer(). Constructor for class java.rmi.server.RemoteServer RemoteServer(RemoteRef). Constructor for class java.rmi.server.RemoteServer RemoteStub(). Constructor for class java.rmi.server.RemoteStub Constructor for RemoteStub. RemoteStub(RemoteRef). Constructor for class java.rmi.server.RemoteStub Constructor for RemoteStub, with the specified remote reference. remoteToString(). Method in interface java.rmi.server.RemoteRef Returns a String that represents the reference of this remote object.

ww w. ja

va
392

dil

i.c o

m

393
remove(ActionListener, ActionListener). Static method in class java.awt.AWTEventMulticaster Removes the old action-listener from action-listener-l and returns the resulting multicast listener. remove(AdjustmentListener, AdjustmentListener). Static method in class java.awt.AWTEventMulticaster Removes the old adjustment-listener from adjustment-listener-l and returns the resulting multicast listener. remove(Component). Method in class java.awt.Container Removes the specified component from this container. remove(ComponentListener, ComponentListener). Static method in class java.awt.AWTEventMulticaster Removes the old component-listener from component-listener-l and returns the resulting multicast listener. remove(ContainerListener, ContainerListener). Static method in class java.awt.AWTEventMulticaster Removes the old container-listener from container-listener-l and returns the resulting multicast listener. remove(EventListener). Method in class java.awt.AWTEventMulticaster Removes a listener from this multicaster and returns the resulting multicast listener. remove(FocusListener, FocusListener). Static method in class java.awt.AWTEventMulticaster Removes the old focus-listener from focus-listener-l and returns the resulting multicast listener. remove(int). Method in class java.awt.Choice Removes an item from the choice menu. remove(int). Method in interface java.awt.peer.ChoicePeer remove(int). Method in class java.awt.Container Removes the component at the specified index from this container. remove(int). Method in class java.awt.List Removes an item from the list. remove(int). Method in class java.awt.Menu Deletes the item from this menu at the specified index. remove(int). Method in class java.awt.MenuBar Removes the menu located at the specified index from the menu bar. remove(ItemListener, ItemListener). Static method in class java.awt.AWTEventMulticaster Removes the old item-listener from item-listener-l and returns the resulting multicast listener. remove(KeyListener, KeyListener). Static method in class java.awt.AWTEventMulticaster Removes the old key-listener from key-listener-l and returns the resulting multicast listener. remove(MenuComponent). Method in class java.awt.Component Removes the specified popup menu from the component. remove(MenuComponent). Method in class java.awt.Frame Removes the specified menu bar from this Frame. remove(MenuComponent). Method in class java.awt.Menu Deletes the specified item from this menu. remove(MenuComponent). Method in class java.awt.MenuBar Removes the specified menu from the menu bar. remove(MenuComponent). Method in interface java.awt.MenuContainer remove(MouseListener, MouseListener). Static method in class java.awt.AWTEventMulticaster Removes the old mouse-listener from mouse-listener-l and returns the resulting multicast listener. remove(MouseMotionListener, MouseMotionListener). Static method in class java.awt.AWTEventMulticaster Removes the old mouse-motion-listener from mouse-motion-listener-l and returns the resulting multicast listener. remove(Object). Method in class java.util.Dictionary Removes the key (and its corresponding value) from this dictionary. remove(Object). Method in class java.util.Hashtable Removes the key (and its corresponding value) from this hashtable. remove(String). Method in class java.awt.Choice Remove the first occurrence of item from the choice menu. remove(String). Method in class java.awt.List Remove the first occurrence of item from the list. remove(TextListener, TextListener). Static method in class java.awt.AWTEventMulticaster remove(WindowListener, WindowListener). Static method in class java.awt.AWTEventMulticaster Removes the old window-listener from window-listener-l and returns the resulting multicast listener. removeActionListener(ActionListener). Method in class java.awt.Button Removes the specified action listener so it no longer receives action events from this button. removeActionListener(ActionListener). Method in class java.awt.List Removes the specified action listener so it no longer receives action events from this list. removeActionListener(ActionListener). Method in class java.awt.MenuItem Removes the specified action listener so it no longer receives action events from this menu item. removeActionListener(ActionListener). Method in class java.awt.TextField Removes the specified action listener so that it no longer receives action events from this textfield. removeAdjustmentListener(AdjustmentListener). Method in interface java.awt.Adjustable Removes an adjustment listener. removeAdjustmentListener(AdjustmentListener). Method in class java.awt.Scrollbar Removes the specified adjustment listener so that it no longer receives adjustment events from this scrollbar.. removeAll(). Method in class java.awt.Choice Removes all items from the choice menu. removeAll(). Method in class java.awt.Container Removes all the components from this container. removeAll(). Method in class java.awt.List Removes all items from the list. removeAll(). Method in interface java.awt.peer.ListPeer removeAll(). Method in class java.awt.Menu Deletes all items from this menu. removeAllElements(). Method in class java.util.Vector Removes all components from this vector and sets its size to zero.

ww w. ja

va
393

dil

i.c o

m

394
removeCertificate(Certificate). Method in class java.security.Identity Removes a certificate from this identity. removeComponentListener(ComponentListener). Method in class java.awt.Component Removes the specified listener so it no longer receives component events from this component. removeConsumer(ImageConsumer). Method in class java.awt.image.FilteredImageSource Removes an ImageConsumer from the list of consumers interested in data for this image. removeConsumer(ImageConsumer). Method in interface java.awt.image.ImageProducer This method removes the given ImageConsumer object from the list of consumers currently registered to receive image data. removeConsumer(ImageConsumer). Method in class java.awt.image.MemoryImageSource Remove an ImageConsumer from the list of consumers interested in data for this image. removeContainerListener(ContainerListener). Method in class java.awt.Container Removes the specified container listener so it no longer receives container events from this container. removeElement(Object). Method in class java.util.Vector Removes the first occurrence of the argument from this vector. removeElementAt(int). Method in class java.util.Vector Deletes the component at the specified index. removeEntry(Principal, AclEntry). Method in interface java.security.acl.Acl Removes an ACL entry from this ACL. removeFocusListener(FocusListener). Method in class java.awt.Component Removes the specified focus listener so it no longer receives focus events from this component. removeIdentity(Identity). Method in class java.security.IdentityScope Removes an identity from this identity scope. removeImage(Image). Method in class java.awt.MediaTracker Remove the specified Image from this MediaTracker. removeImage(Image, int). Method in class java.awt.MediaTracker Remove the specified Image from the specified ID of this MediaTracker. removeImage(Image, int, int, int). Method in class java.awt.MediaTracker Remove the specified image with the specified size and ID from this MediaTracker. removeInternal(EventListener, EventListener). Static method in class java.awt.AWTEventMulticaster Returns the resulting multicast listener after removing the old listener from listener-l. removeItemListener(ItemListener). Method in class java.awt.Checkbox Removes the specified item listener so that it no longer receives item events from this checkbox. removeItemListener(ItemListener). Method in class java.awt.CheckboxMenuItem Removes the specified item listener so it no longer receives item events from this checkbox menu item. removeItemListener(ItemListener). Method in class java.awt.Choice Removes the specified item listener so that it no longer receives item events from this choice. removeItemListener(ItemListener). Method in interface java.awt.ItemSelectable Removes an item listener. removeItemListener(ItemListener). Method in class java.awt.List Removes the specified item listener so it no longer receives item events from this list. removeKeyListener(KeyListener). Method in class java.awt.Component Removes the specified key listener so it no longer receives key events from this component. removeLayoutComponent(Component). Method in class java.awt.BorderLayout Removes the specified component from the layout. removeLayoutComponent(Component). Method in class java.awt.CardLayout Removes the specified component from the layout. removeLayoutComponent(Component). Method in class java.awt.FlowLayout Removes the specified component from the layout. removeLayoutComponent(Component). Method in class java.awt.GridBagLayout Removes the specified component from the layout. removeLayoutComponent(Component). Method in class java.awt.GridLayout Removes the specified component from the layout. removeLayoutComponent(Component). Method in interface java.awt.LayoutManager Removes the specified component from the layout. removeMember(Principal). Method in interface java.security.acl.Group Removes the specified member from the group. removeMouseListener(MouseListener). Method in class java.awt.Component Removes the specified mouse listener so it no longer receives mouse events from this component. removeMouseMotionListener(MouseMotionListener). Method in class java.awt.Component Removes the specified mouse motion listener so it no longer receives mouse motion events from this component. removeNotify(). Method in class java.awt.Component Notifies the Component that it has been removed from its container and if a peers ecists, it destroys it. removeNotify(). Method in class java.awt.Container Notifies the container to remove its peer. removeNotify(). Method in class java.awt.List Removes the peer for this list. removeNotify(). Method in class java.awt.Menu Removes the menu's peer. removeNotify(). Method in class java.awt.MenuBar Removes the menu bar's peer. removeNotify(). Method in class java.awt.MenuComponent Removes the menu component's peer. removeNotify(). Method in class java.awt.TextComponent Removes the TextComponent's peer. removePermission(Permission). Method in interface java.security.acl.AclEntry Removes the specified permission from this ACL entry.

ww w. ja

va
394

dil

i.c o

m

395
removePropertyChangeListener(PropertyChangeListener). Method in interface java.beans.Customizer Remove a listener for the PropertyChange event. removePropertyChangeListener(PropertyChangeListener). Method in class java.beans.PropertyChangeSupport Remove a PropertyChangeListener from the listener list. removePropertyChangeListener(PropertyChangeListener). Method in interface java.beans.PropertyEditor Remove a listener for the PropertyChange event. removePropertyChangeListener(PropertyChangeListener). Method in class java.beans.PropertyEditorSupport Remove a listener for the PropertyChange event. removeProvider(String). Static method in class java.security.Security Removes the provider with the specified name. removeTextListener(TextListener). Method in class java.awt.TextComponent Removes the specified text event listener so that it no longer receives text events from this textcomponent removeVetoableChangeListener(VetoableChangeListener). Method in class java.beans.VetoableChangeSupport Remove a VetoableChangeListener from the listener list. removeWindowListener(WindowListener). Method in class java.awt.Window Removes the specified window listener so that it no longer receives window events from this window. renameTo(File). Method in class java.io.File Renames the file specified by this File object to have the pathname given by the File argument. repaint(). Method in class java.awt.Component Repaints the component. repaint(int, int, int, int). Method in class java.awt.Component Repaints part of the component. repaint(long). Method in class java.awt.Component Repaints the component. repaint(long, int, int, int, int). Method in class java.awt.Component Repaints part of the component. repaint(long, int, int, int, int). Method in interface java.awt.peer.ComponentPeer replace(char, char). Method in class java.lang.String Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar. replaceItem(String, int). Method in class java.awt.List Replaces the item at the given index. replaceObject(Object). Method in class java.io.ObjectOutputStream This method will allow trusted subclasses of ObjectOutputStream to substitute one object for another during serialization. replaceRange(String, int, int). Method in class java.awt.TextArea Replaces text from the indicated start to end position with the new text specified. replaceRange(String, int, int). Method in interface java.awt.peer.TextAreaPeer replaceText(String, int, int). Method in class java.awt.TextArea replaceText(String, int, int). Method in interface java.awt.peer.TextAreaPeer DEPRECATED: Replaced by ReplaceRange(String, int, int). ReplicateScaleFilter(int, int). Constructor for class java.awt.image.ReplicateScaleFilter Constructs a ReplicateScaleFilter that scales the pixels from its source Image as specified by the width and height parameters. requestFocus(). Method in class java.awt.Component Requests the input focus. requestFocus(). Method in interface java.awt.peer.ComponentPeer requestTopDownLeftRightResend(ImageConsumer). Method in class java.awt.image.FilteredImageSource Requests that a given ImageConsumer have the image data delivered one more time in top-down, left-right order. requestTopDownLeftRightResend(ImageConsumer). Method in interface java.awt.image.ImageProducer This method is used by an ImageConsumer to request that the ImageProducer attempt to resend the image data one more time in TOPDOWNLEFTRIGHT order so that higher quality conversion algorithms which depend on receiving pixels in order can be used to produce a better output version of the image. requestTopDownLeftRightResend(ImageConsumer). Method in class java.awt.image.MemoryImageSource Requests that a given ImageConsumer have the image data delivered one more time in top-down, left-right order. required. Variable in class java.sql.DriverPropertyInfo "required" is true if a value must be supplied for this property during Driver.connect. resendTopDownLeftRight(ImageProducer). Method in class java.awt.image.ImageFilter Responds to a request for a TopDownLeftRight (TDLR) ordered resend of the pixel data from an ImageConsumer. reset(). Method in class java.util.zip.Adler32 Resets checksum to initial value. reset(). Method in class java.io.BufferedInputStream Repositions this stream to the position at the time the mark method was last called on this input stream. reset(). Method in class java.io.BufferedReader Reset the stream to the most recent mark. reset(). Method in class java.io.ByteArrayInputStream Resets the buffer to the marked position. reset(). Method in class java.io.ByteArrayOutputStream Resets the count field of this byte array output stream to zero, so that all currently accumulated output in the ouput stream is discarded. reset(). Method in class java.io.CharArrayReader Reset the stream to the most recent mark, or to the beginning if it has never been marked. reset(). Method in class java.io.CharArrayWriter Resets the buffer so that you can use it again without throwing away the already allocated buffer. reset(). Method in interface java.util.zip.Checksum Resets the checksum to its initial value. reset(). Method in class java.text.CollationElementIterator Resets the cursor to the beginning of the string. reset(). Method in class java.util.zip.CRC32

ww w. ja

va
395

dil

i.c o

m

396
Resets CRC-32 to initial value. reset(). Method in class java.util.zip.Deflater Resets deflater so that a new set of input data can be processed. reset(). Method in class java.io.FilterInputStream Repositions this stream to the position at the time the mark method was last called on this input stream. reset(). Method in class java.io.FilterReader Reset the stream. reset(). Method in class java.util.zip.Inflater Resets inflater so that a new set of input data can be processed. reset(). Method in class java.io.InputStream Repositions this stream to the position at the time the mark method was last called on this input stream. reset(). Method in class java.io.LineNumberInputStream Repositions this stream to the position at the time the mark method was last called on this input stream. reset(). Method in class java.io.LineNumberReader Reset the stream to the most recent mark. reset(). Method in class java.security.MessageDigest Resets the digest for further use. reset(). Method in class java.io.ObjectOutputStream Reset will disregard the state of any objects already written to the stream. reset(). Method in class java.io.Reader Reset the stream. reset(). Method in class java.io.StringBufferInputStream Resets the input stream to begin reading from the first character of this input stream's underlying buffer. reset(). Method in class java.io.StringReader Reset the stream to the most recent mark, or to the beginning of the string if it has never been marked. resetCurrentFrameIndex(). Method in class sun.tools.debug.RemoteThread Reset the current stackframe resetSyntax(). Method in class java.io.StreamTokenizer Resets this tokenizer's syntax table so that all characters are "ordinary." See the ordinaryChar method for more information on a character being ordinary. reshape(int, int, int, int). Method in class java.awt.Component reshape(int, int, int, int). Method in interface java.awt.peer.ComponentPeer DEPRECATED: Replaced by setBounds(int, int, int, int). reshape(int, int, int, int). Method in class java.awt.Rectangle resize(Dimension). Method in class java.applet.Applet Requests that this applet be resized. resize(Dimension). Method in class java.awt.Component resize(int, int). Method in class java.applet.Applet Requests that this applet be resized. resize(int, int). Method in class java.awt.Component resize(int, int). Method in class java.awt.Rectangle resolveClass(Class). Method in class java.lang.ClassLoader Resolves the class so that an instance of the class can be created, or so that one of its methods can be called. resolveClass(ObjectStreamClass). Method in class java.io.ObjectInputStream Subclasses may implement this method to allow classes to be fetched from an alternate source. resolveObject(Object). Method in class java.io.ObjectInputStream This method will allow trusted subclasses of ObjectInputStream to substitute one object for another during deserialization. ResourceBundle(). Constructor for class java.util.ResourceBundle responseCode. Variable in class java.net.HttpURLConnection responseMessage. Variable in class java.net.HttpURLConnection resume(). Method in class sun.tools.debug.RemoteThread Resume execution of this thread. resume(). Method in class java.lang.Thread Resumes a suspended thread. resume(). Method in class java.lang.ThreadGroup Resumes all processes in this thread group. reverse(). Method in class java.lang.StringBuffer The character sequence contained in this string buffer is replaced by the reverse of the sequence. RGBImageFilter(). Constructor for class java.awt.image.RGBImageFilter RGBtoHSB(int, int, int, float[]). Static method in class java.awt.Color Returns the HSB values corresponding to the color defined by the red, green, and blue components. RIGHT. Static variable in class java.awt.Event The right arrow action-key. RIGHT. Static variable in class java.awt.FlowLayout The right alignment variable. right. Variable in class java.awt.Insets The inset from the right. RIGHT. Static variable in class java.awt.Label The right alignment. RIGHT_ALIGNMENT. Static variable in class java.awt.Component Ease of use constant for getAlignmentX(). rint(double). Static method in class java.lang.Math returns the closest integer to the argument. RMISecurityException(String). Constructor for class java.rmi.RMISecurityException Constructs a RMISecurityException with no detail message. RMISecurityException(String, String). Constructor for class java.rmi.RMISecurityException

ww w. ja

va
396

dil

i.c o

m

397
Constructs a RMISecurityException with the specified detail message. RMISecurityManager(). Constructor for class java.rmi.RMISecurityManager Construct and initialize. RMISocketFactory(). Constructor for class java.rmi.server.RMISocketFactory roll(int, boolean). Method in class java.util.Calendar Time Field Rolling function. roll(int, boolean). Method in class java.util.GregorianCalendar Overrides Calendar Time Field Rolling function. rollback(). Method in interface java.sql.Connection Rollback drops all changes made since the previous commit/rollback and releases any database locks currently held by the Connection. round(double). Static method in class java.lang.Math Returns the closest long to the argument. round(float). Static method in class java.lang.Math Returns the closest int to the argument. ROUND_CEILING. Static variable in class java.math.BigDecimal If the BigDecimal is positive, behave as for ROUND_UP; if negative, behave as for ROUND_DOWN. ROUND_DOWN. Static variable in class java.math.BigDecimal Never increment the digit prior to a discarded fraction (i.e., truncate). ROUND_FLOOR. Static variable in class java.math.BigDecimal If the BigDecimal is positive, behave as for ROUND_DOWN; if negative behave as for ROUND_UP. ROUND_HALF_DOWN. Static variable in class java.math.BigDecimal Behave as for ROUND_UP if the discarded fraction is > .5; otherwise, behave as for ROUND_DOWN. ROUND_HALF_EVEN. Static variable in class java.math.BigDecimal Behave as for ROUND_HALF_UP if the digit to the left of the discarded fraction is odd; behave as for ROUND_HALF_DOWN if it's even. ROUND_HALF_UP. Static variable in class java.math.BigDecimal Behave as for ROUND_UP if the discarded fraction is >= .5; otherwise, behave as for ROUND_DOWN. ROUND_UNNECESSARY. Static variable in class java.math.BigDecimal This "pseudo-rounding-mode" is actually an assertion that the requested operation has an exact result, hence no rounding is necessary. ROUND_UP. Static variable in class java.math.BigDecimal Always increment the digit prior to a non-zero discarded fraction. rowHeights. Variable in class java.awt.GridBagLayout rowWeights. Variable in class java.awt.GridBagLayout RuleBasedCollator(String). Constructor for class java.text.RuleBasedCollator RuleBasedCollator constructor. run(). Method in interface java.lang.Runnable When an object implementing interface Runnable is used to create a thread, starting the thread causes the object's run method to be called in that separately executing thread. run(). Method in class java.lang.Thread If this thread was constructed using a separate Runnable run object, then that Runnable object's run method is called; otherwise, this method does nothing and returns. run(int, String[]). Method in class sun.tools.debug.RemoteDebugger Load and run a runnable Java class, with any optional parameters. runFinalization(). Method in class java.lang.Runtime Runs the finalization methods of any objects pending finalization. runFinalization(). Static method in class java.lang.System Runs the finalization methods of any objects pending finalization. runFinalizersOnExit(boolean). Static method in class java.lang.Runtime Enable or disable finalization on exit; doing so specifies that the finalizers of all objects that have finalizers that have not yet been automatically invoked are to be run before the Java runtime exits. runFinalizersOnExit(boolean). Static method in class java.lang.System Enable or disable finalization on exit; doing so specifies that the finalizers of all objects that have finalizers that have not yet been automatically invoked are to be run before the Java runtime exits. RuntimeException(). Constructor for class java.lang.RuntimeException Constructs a RuntimeException with no detail message. RuntimeException(String). Constructor for class java.lang.RuntimeException Constructs a RuntimeException with the specified detail message.

ww w. ja
S S_RESIZE_CURSOR. Static variable in class java.awt.Cursor The south-resize cursor type. S_RESIZE_CURSOR. Static variable in class java.awt.Frame sameFile(URL). Method in class java.net.URL Compares two URLs, excluding the "ref" fields. SATURDAY. Static variable in class java.util.Calendar Useful constant for days of week. SAVE. Static variable in class java.awt.FileDialog The file save variable. save(OutputStream, String). Method in class java.util.Properties Stores this property list to the specified output stream. SAVE_FILE. Static variable in class java.awt.Event

va
397

dil

i.c o

m

398
A file saving event. saveInternal(ObjectOutputStream, String). Method in class java.awt.AWTEventMulticaster scale(). Method in class java.math.BigDecimal Returns the scale of this number. SCALE_AREA_AVERAGING. Static variable in class java.awt.Image Use the Area Averaging image scaling algorithm. SCALE_DEFAULT. Static variable in class java.awt.Image Use the default image scaling algorithm. SCALE_FAST. Static variable in class java.awt.Image Choose an image scaling algorithm that gives higher priority to scaling speed than smoothness of the scaled image. SCALE_REPLICATE. Static variable in class java.awt.Image Use the ReplicateScaleFilter image scaling algorithm. SCALE_SMOOTH. Static variable in class java.awt.Image Choose an image scaling algorithm that gives higher priority to image smoothness than scaling speed. SCROLL_ABSOLUTE. Static variable in class java.awt.Event The absolute scroll event. SCROLL_BEGIN. Static variable in class java.awt.Event The scroll begin event. SCROLL_END. Static variable in class java.awt.Event The scroll end event. SCROLL_LINE_DOWN. Static variable in class java.awt.Event The line down scroll event. SCROLL_LINE_UP. Static variable in class java.awt.Event The line up scroll event. SCROLL_LOCK. Static variable in class java.awt.Event The ScrollLock action-key. SCROLL_PAGE_DOWN. Static variable in class java.awt.Event The page down scroll event. SCROLL_PAGE_UP. Static variable in class java.awt.Event The page up scroll event. scrollbar. Static variable in class java.awt.SystemColor The background color for scrollbars. SCROLLBAR. Static variable in class java.awt.SystemColor The array index for the scrollbar background color. Scrollbar(). Constructor for class java.awt.Scrollbar Constructs a new vertical Scrollbar. Scrollbar(int). Constructor for class java.awt.Scrollbar Constructs a new Scrollbar with the specified orientation. Scrollbar(int, int, int, int, int). Constructor for class java.awt.Scrollbar Constructs a new Scrollbar with the specified orientation, value, page size, and minumum and maximum values. SCROLLBARS_ALWAYS. Static variable in class java.awt.ScrollPane Specifies that horizontal/vertical scrollbars should always be shown regardless of the respective sizes of the scrollpane and child. SCROLLBARS_AS_NEEDED. Static variable in class java.awt.ScrollPane Specifies that horizontal/vertical scrollbar should be shown only when the size of the child exceeds the size of the scrollpane in the horizontal/vertical dimension. SCROLLBARS_BOTH. Static variable in class java.awt.TextArea Create and display both vertical and horizontal scrollbars. SCROLLBARS_HORIZONTAL_ONLY. Static variable in class java.awt.TextArea Create and display horizontal scrollbar only. SCROLLBARS_NEVER. Static variable in class java.awt.ScrollPane Specifies that horizontal/vertical scrollbars should never be shown regardless of the respective sizes of the scrollpane and child. SCROLLBARS_NONE. Static variable in class java.awt.TextArea Do not create or display any scrollbars for the text area. SCROLLBARS_VERTICAL_ONLY. Static variable in class java.awt.TextArea Create and display vertical scrollbar only. ScrollPane(). Constructor for class java.awt.ScrollPane Create a new scrollpane container with a scrollbar display policy of "as needed". ScrollPane(int). Constructor for class java.awt.ScrollPane Create a new scrollpane container. SE_RESIZE_CURSOR. Static variable in class java.awt.Cursor The south-east-resize cursor type. SE_RESIZE_CURSOR. Static variable in class java.awt.Frame search(Object). Method in class java.util.Stack Returns where an object is on this stack. SECOND. Static variable in class java.util.Calendar Useful constant for date and time. SECOND_FIELD. Static variable in class java.text.DateFormat Useful constant for SECOND field alignment. SECONDARY. Static variable in class java.text.Collator Collator strength value. secondaryOrder(int). Static method in class java.text.CollationElementIterator Get the secondary order of a collation order. SecureRandom(). Constructor for class java.security.SecureRandom This empty constructor automatically seeds the generator.

ww w. ja

va
398

dil

i.c o

m

399
SecureRandom(byte[]). Constructor for class java.security.SecureRandom This constructor uses a user-provided seed in preference to the self-seeding algorithm referred to in the empty constructor description. SecurityException(). Constructor for class java.lang.SecurityException Constructs a SecurityException with no detail message. SecurityException(String). Constructor for class java.lang.SecurityException Constructs a SecurityException with the specified detail message. SecurityManager(). Constructor for class java.lang.SecurityManager Constructs a new SecurityManager. seek(long). Method in class java.io.RandomAccessFile Sets the offset from the beginning of this file at which the next read or write occurs. select(int). Method in class java.awt.Choice Selects the item with the specified postion. select(int). Method in interface java.awt.peer.ChoicePeer select(int). Method in class java.awt.List Selects the item at the specified index. select(int). Method in interface java.awt.peer.ListPeer select(int, int). Method in class java.awt.TextComponent Selects the text found between the specified start and end locations. select(int, int). Method in interface java.awt.peer.TextComponentPeer select(String). Method in class java.awt.Choice Selects the item with the specified String. selectAll(). Method in class java.awt.TextComponent Selects all the text in the TextComponent. SELECTED. Static variable in class java.awt.event.ItemEvent The item selected state change type. send(DatagramPacket). Method in class java.net.DatagramSocket Sends a datagram packet from this socket. send(DatagramPacket). Method in class java.net.DatagramSocketImpl Sends a datagram packet. send(DatagramPacket, byte). Method in class java.net.MulticastSocket Sends a datagram packet to the destination, with a TTL (time- to-live) other than the default for the socket. separator. Static variable in class java.io.File The system-dependent path separator character. separatorChar. Static variable in class java.io.File The system-dependent path separator string. SEPTEMBER. Static variable in class java.util.Calendar Useful constant for month. SequenceInputStream(Enumeration). Constructor for class java.io.SequenceInputStream Constructs a new sequence input stream initialized to the specified enumeration of input streams. SequenceInputStream(InputStream, InputStream). Constructor for class java.io.SequenceInputStream Constructs a new sequence input stream initialized to read first from the input stream s1, and then from the input stream s2. ServerCloneException(String). Constructor for class java.rmi.server.ServerCloneException Create A remote exception with the specified string ServerCloneException(String, Exception). Constructor for class java.rmi.server.ServerCloneException Create A remote exception with the specified string, and the exception specified. ServerError(String, Error). Constructor for class java.rmi.ServerError Create a new "server error" exception with the string and the specified exception. ServerException(String). Constructor for class java.rmi.ServerException Create a new server exception with a descriptive string. ServerException(String, Exception). Constructor for class java.rmi.ServerException Create a new server exception with a descriptive string and an exception. ServerNotActiveException(). Constructor for class java.rmi.server.ServerNotActiveException Create a new exception. ServerNotActiveException(String). Constructor for class java.rmi.server.ServerNotActiveException ServerRuntimeException(String, Exception). Constructor for class java.rmi.ServerRuntimeException Create a new runtime exception with the strings and the specified exception. ServerSocket(int). Constructor for class java.net.ServerSocket Creates a server socket on a specified port. ServerSocket(int, int). Constructor for class java.net.ServerSocket Creates a server socket and binds it to the specified local port number. ServerSocket(int, int, InetAddress). Constructor for class java.net.ServerSocket Create a server with the specified port, listen backlog, and local IP address to bind to. set(int). Method in class java.util.BitSet Sets the bit specified by the index to true. set(int, int). Method in class java.util.Calendar Sets the time field with the given value. set(int, int, int). Method in class java.util.Calendar Sets the values for the fields year, month, and date. set(int, int, int, int, int). Method in class java.util.Calendar Sets the values for the fields year, month, date, hour, and minute. set(int, int, int, int, int, int). Method in class java.util.Calendar Sets the values for the fields year, month, date, hour, minute, and second. set(Object, int, Object). Static method in class java.lang.reflect.Array Sets the value of the indexed component of the specified array object to the specified new value.

ww w. ja

va
399

dil

i.c o

m

400
set(Object, Object). Method in class java.lang.reflect.Field Sets the field represented by this Field object on the specified object argument to the specified new value. set(String, String, int, String, String). Method in class java.net.URL Sets the fields of the URL. setActionCommand(String). Method in class java.awt.Button Sets the command name of the action event fired by this button. setActionCommand(String). Method in class java.awt.MenuItem Sets the command name of the action event fired by this menu item. setAddress(InetAddress). Method in class java.net.DatagramPacket setAlignment(int). Method in class java.awt.FlowLayout Sets the alignment value for this layout. setAlignment(int). Method in class java.awt.Label Sets the alignment for this label to the specified alignment. setAlignment(int). Method in interface java.awt.peer.LabelPeer setAllowUserInteraction(boolean). Method in class java.net.URLConnection Set the value of the allowUserInteraction field of this URLConnection. setAmPmStrings(String[]). Method in class java.text.DateFormatSymbols Sets ampm strings. setAnimated(boolean). Method in class java.awt.image.MemoryImageSource Change this memory image into a multi-frame animation or a single-frame static image depending on the animated parameter. setAsciiStream(int, InputStream, int). Method in interface java.sql.PreparedStatement When a very large ASCII value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.InputStream. setAsText(String). Method in interface java.beans.PropertyEditor Set the property value by parsing a given String. setAsText(String). Method in class java.beans.PropertyEditorSupport Set the property value by parsing a given String. setAutoCommit(boolean). Method in interface java.sql.Connection If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions. setBackground(Color). Method in class java.awt.Component Sets the background color. setBackground(Color). Method in interface java.awt.peer.ComponentPeer setBeanInfoSearchPath(String[]). Static method in class java.beans.Introspector Change the list of package names that will be used for finding BeanInfo classes. setBigDecimal(int, BigDecimal). Method in interface java.sql.PreparedStatement Set a parameter to a java.lang.BigDecimal value. setBinaryStream(int, InputStream, int). Method in interface java.sql.PreparedStatement When a very large binary value is input to a LONGVARBINARY parameter, it may be more practical to send it via a java.io.InputStream. setBit(int). Method in class java.math.BigInteger Returns a BigInteger whose value is equivalent to this number with the designated bit set. setBlockIncrement(int). Method in interface java.awt.Adjustable Sets the block value increment for the adjustable object. setBlockIncrement(int). Method in class java.awt.Scrollbar Sets the block increment for this scrollbar. setBoolean(int, boolean). Method in interface java.sql.PreparedStatement Set a parameter to a Java boolean value. setBoolean(Object, boolean). Method in class java.lang.reflect.Field Set the value of a field as a boolean on specified object. setBoolean(Object, int, boolean). Static method in class java.lang.reflect.Array Sets the value of the indexed component of the specified array object to the specified boolean value. setBound(boolean). Method in class java.beans.PropertyDescriptor Updates to "bound" properties will cause a "PropertyChange" event to get fired when the property is changed. setBounds(int, int, int, int). Method in class java.awt.Component Reshapes the Component to the specified bounding box. setBounds(int, int, int, int). Method in interface java.awt.peer.ComponentPeer setBounds(int, int, int, int). Method in class java.awt.Rectangle Set the bounds of this rectangle to the specified x, y, width, and height. setBounds(Rectangle). Method in class java.awt.Component Reshapes the Component to the specified bounding box. setBounds(Rectangle). Method in class java.awt.Rectangle Set the bounds of this rectangle to match the specified rectangle. setBreakpointLine(int). Method in class sun.tools.debug.RemoteClass Set a breakpoint at a specified source line number in a class. setBreakpointMethod(RemoteField). Method in class sun.tools.debug.RemoteClass Set a breakpoint at the first line of a class method. setByte(int, byte). Method in interface java.sql.PreparedStatement Set a parameter to a Java byte value. setByte(Object, byte). Method in class java.lang.reflect.Field Set the value of a field as a byte on specified object. setByte(Object, int, byte). Static method in class java.lang.reflect.Array

ww w. ja

va
400

dil

i.c o

m

401
Sets the value of the indexed component of the specified array object to the specified boolean value. setBytes(int, byte[]). Method in interface java.sql.PreparedStatement Set a parameter to a Java array of bytes. setCalendar(Calendar). Method in class java.text.DateFormat Set the calendar to be used by this date format. setCaretPosition(int). Method in class java.awt.TextComponent Sets the position of the text insertion caret for the TextComponent setCaretPosition(int). Method in interface java.awt.peer.TextComponentPeer setCatalog(String). Method in interface java.sql.Connection A sub-space of this Connection's database may be selected by setting a catalog name. setChanged(). Method in class java.util.Observable Indicates that this object has changed. setChar(Object, char). Method in class java.lang.reflect.Field Set the value of a field as a char on specified object. setChar(Object, int, char). Static method in class java.lang.reflect.Array Sets the value of the indexed component of the specified array object to the specified byte value. setCharAt(int, char). Method in class java.lang.StringBuffer The character at the specified index of this string buffer is set to ch. setCheckboxGroup(CheckboxGroup). Method in class java.awt.Checkbox Sets the CheckboxGroup to the specified group. setCheckboxGroup(CheckboxGroup). Method in interface java.awt.peer.CheckboxPeer setChoices(double[], String[]). Method in class java.text.ChoiceFormat Set the choices to be used in formatting. setClip(int, int, int, int). Method in class java.awt.Graphics Sets the current clip to the rectangle specified by the given coordinates. setClip(Shape). Method in class java.awt.Graphics Set the current clipping area to an arbitrary clip shape. setColor(Color). Method in class java.awt.Graphics Sets the current color to the specified color. setColorModel(ColorModel). Method in interface java.awt.image.ImageConsumer The ColorModel object used for the majority of the pixels reported using the setPixels method calls. setColorModel(ColorModel). Method in class java.awt.image.ImageFilter Filter the information provided in the setColorModel method of the ImageConsumer interface. setColorModel(ColorModel). Method in class java.awt.image.PixelGrabber The setColorModel method is part of the ImageConsumer API which this class must implement to retrieve the pixels. setColorModel(ColorModel). Method in class java.awt.image.RGBImageFilter If the ColorModel is an IndexColorModel, and the subclass has set the canFilterIndexColorModel flag to true, we substitute a filtered version of the color model here and wherever that original ColorModel object appears in the setPixels methods. setColumns(int). Method in class java.awt.GridLayout Sets the number of columns in this layout. setColumns(int). Method in class java.awt.TextArea Sets the number of columns for this TextArea. setColumns(int). Method in class java.awt.TextField Sets the number of columns in this TextField. setComment(String). Method in class java.util.zip.ZipEntry Sets the optional comment string for the entry. setComment(String). Method in class java.util.zip.ZipOutputStream Sets the ZIP file comment. setConstrained(boolean). Method in class java.beans.PropertyDescriptor Attempted updates to "Constrained" properties will cause a "VetoableChange" event to get fired when the property is changed. setConstraints(Component, GridBagConstraints). Method in class java.awt.GridBagLayout Sets the constraints for the specified component. setContentHandlerFactory(ContentHandlerFactory). Static method in class java.net.URLConnection Sets the ContentHandlerFactory of an application. setContents(Transferable, ClipboardOwner). Method in class java.awt.datatransfer.Clipboard Sets the current contents of the clipboard to the specified transferable object and registers the specified clipboard owner as the owner of the new contents. setCrc(long). Method in class java.util.zip.ZipEntry Sets the CRC-32 checksum of the uncompressed entry data. setCurrent(Checkbox). Method in class java.awt.CheckboxGroup setCurrentFrameIndex(int). Method in class sun.tools.debug.RemoteThread Set the current stackframe index setCursor(Cursor). Method in class java.awt.Component Set the cursor image to a predefined cursor. setCursor(Cursor). Method in interface java.awt.peer.ComponentPeer setCursor(int). Method in class java.awt.Frame setCursorName(String). Method in interface java.sql.Statement setCursorname defines the SQL cursor name that will be used by subsequent Statement execute methods. setDaemon(boolean). Method in class java.lang.Thread

ww w. ja

va
401

dil

i.c o

m

402
Marks this thread as either a daemon thread or a user thread. setDaemon(boolean). Method in class java.lang.ThreadGroup Changes the daemon status of this thread group. setData(byte[]). Method in class java.net.DatagramPacket setDate(int). Method in class java.util.Date Sets the day of the month of this date to the specified value. setDate(int). Method in class java.sql.Time Sets the day of the month of this date to the specified value. setDate(int, Date). Method in interface java.sql.PreparedStatement Set a parameter to a java.sql.Date value. setDateFormatSymbols(DateFormatSymbols). Method in class java.text.SimpleDateFormat Allows you to set the date/time formatting data. setDecimalFormatSymbols(DecimalFormatSymbols). Method in class java.text.DecimalFormat Sets the decimal format symbols, which is generally not changed by the programmer or user. setDecimalSeparator(char). Method in class java.text.DecimalFormatSymbols setDecimalSeparatorAlwaysShown(boolean). Method in class java.text.DecimalFormat Allows you to set the behavior of the decimal separator with integers. setDecomposition(int). Method in class java.text.Collator Set the decomposition mode of this Collator. setDefault(Locale). Static method in class java.util.Locale Sets the default. setDefault(TimeZone). Static method in class java.util.TimeZone Sets time zone to using the given TimeZone. setDefaultAllowUserInteraction(boolean). Static method in class java.net.URLConnection Sets the default value of the allowUserInteraction field for all future URLConnection objects to the specified value. setDefaultRequestProperty(String, String). Static method in class java.net.URLConnection Sets the default value of a general request property. setDefaultStream(PrintStream). Static method in class java.rmi.server.LogStream Set the default stream for new logs. setDefaultUseCaches(boolean). Method in class java.net.URLConnection Sets the default value of the useCaches field to the specified value. setDesignTime(boolean). Static method in class java.beans.Beans Used to indicate whether of not we are running in an application builder environment. setDictionary(byte[]). Method in class java.util.zip.Deflater Sets preset dictionary for compression. setDictionary(byte[]). Method in class java.util.zip.Inflater Sets the preset dictionary to the given array of bytes. setDictionary(byte[], int, int). Method in class java.util.zip.Deflater Sets preset dictionary for compression. setDictionary(byte[], int, int). Method in class java.util.zip.Inflater Sets the preset dictionary to the given array of bytes. setDigit(char). Method in class java.text.DecimalFormatSymbols setDimensions(int, int). Method in class java.awt.image.CropImageFilter Override the source image's dimensions and pass the dimensions of the rectangular cropped region to the ImageConsumer. setDimensions(int, int). Method in interface java.awt.image.ImageConsumer The dimensions of the source image are reported using the setDimensions method call. setDimensions(int, int). Method in class java.awt.image.ImageFilter Filters the information provided in the setDimensions method of the ImageConsumer interface. setDimensions(int, int). Method in class java.awt.image.PixelGrabber The setDimensions method is part of the ImageConsumer API which this class must implement to retrieve the pixels. setDimensions(int, int). Method in class java.awt.image.ReplicateScaleFilter Override the dimensions of the source image and pass the dimensions of the new scaled size to the ImageConsumer. setDirectory(String). Method in class java.awt.FileDialog Set the directory of the Dialog to the specified directory. setDirectory(String). Method in interface java.awt.peer.FileDialogPeer setDisplayName(String). Method in class java.beans.FeatureDescriptor setDoInput(boolean). Method in class java.net.URLConnection Sets the value of the doInput field for this URLConnection to the specified value. setDoOutput(boolean). Method in class java.net.URLConnection Sets the value of the doOutput field for this URLConnection to the specified value. setDouble(int, double). Method in interface java.sql.PreparedStatement Set a parameter to a Java double value. setDouble(Object, double). Method in class java.lang.reflect.Field Set the value of a field as a double on specified object. setDouble(Object, int, double). Static method in class java.lang.reflect.Array Sets the value of the indexed component of the specified array object to the specified double value. setEchoChar(char). Method in class java.awt.TextField Sets the echo character for this TextField. setEchoChar(char). Method in interface java.awt.peer.TextFieldPeer setEchoCharacter(char). Method in class java.awt.TextField setEchoCharacter(char). Method in interface java.awt.peer.TextFieldPeer

ww w. ja

va
402

dil

i.c o

m

403
DEPRECATED: Replaced by setEchoChar(char echoChar). setEditable(boolean). Method in class java.awt.TextComponent Sets the specified boolean to indicate whether or not this TextComponent should be editable. setEditable(boolean). Method in interface java.awt.peer.TextComponentPeer setEditorSearchPath(String[]). Static method in class java.beans.PropertyEditorManager Change the list of package names that will be used for finding property editors. setElementAt(Object, int). Method in class java.util.Vector Sets the component at the specified index of this vector to be the specified object. setEnabled(boolean). Method in class java.awt.Component Enables a component. setEnabled(boolean). Method in interface java.awt.peer.ComponentPeer setEnabled(boolean). Method in class java.awt.MenuItem Sets whether or not this menu item can be chosen. setEnabled(boolean). Method in interface java.awt.peer.MenuItemPeer setEndRule(int, int, int, int). Method in class java.util.SimpleTimeZone Sets the daylight savings ending rule. setEras(String[]). Method in class java.text.DateFormatSymbols Sets era strings. setErr(PrintStream). Static method in class java.lang.System Reassigns the "standard" error output stream. setError(). Method in class java.io.PrintStream Indicates that an error has occurred. setError(). Method in class java.io.PrintWriter Indicate that an error has occurred. setEscapeProcessing(boolean). Method in interface java.sql.Statement If escape scanning is on (the default), the driver will do escape substitution before sending the SQL to the database. setExpert(boolean). Method in class java.beans.FeatureDescriptor The "expert" flag is used to distinguish between features that are intended for expert users from those that are intended for normal users. setExtra(byte[]). Method in class java.util.zip.ZipEntry Sets the optional extra field data for the entry. setFailureHandler(RMIFailureHandler). Static method in class java.rmi.server.RMISocketFactory Set the failure handler to be called by the RMI runtime if socket creation fails. setField(int, boolean). Method in class sun.tools.debug.RemoteObject Set a boolean instance variable, specified by slot. setField(int, char). Method in class sun.tools.debug.RemoteObject Set a char instance variable, specified by slot. setField(int, double). Method in class sun.tools.debug.RemoteObject Set a double instance variable, specified by slot. setField(int, float). Method in class sun.tools.debug.RemoteObject Set a float instance variable, specified by slot. setField(int, int). Method in class sun.tools.debug.RemoteObject Set an int instance variable, specified by slot. setField(int, long). Method in class sun.tools.debug.RemoteObject Set a long instance variable, specified by slot. setField(int, RemoteObject). Method in class sun.tools.debug.RemoteObject Set an object instance variable, specified by slot. setField(String, boolean). Method in class sun.tools.debug.RemoteObject Set a boolean instance variable, specified by name. setField(String, char). Method in class sun.tools.debug.RemoteObject Set a char instance variable, specified by name. setField(String, double). Method in class sun.tools.debug.RemoteObject Set a double instance variable, specified by name. setField(String, float). Method in class sun.tools.debug.RemoteObject Set a float instance variable, specified by name. setField(String, int). Method in class sun.tools.debug.RemoteObject Set an int instance variable, specified by name. setField(String, long). Method in class sun.tools.debug.RemoteObject Set a long instance variable, specified by name. setField(String, RemoteObject). Method in class sun.tools.debug.RemoteObject Set an object instance variable, specified by name. setFile(String). Method in class java.awt.FileDialog Sets the file for this dialog to the specified file. setFile(String). Method in interface java.awt.peer.FileDialogPeer setFilenameFilter(FilenameFilter). Method in class java.awt.FileDialog Sets the filter for this dialog to the specified filter. setFilenameFilter(FilenameFilter). Method in interface java.awt.peer.FileDialogPeer setFirstDayOfWeek(int). Method in class java.util.Calendar Sets what the first day of the week is; e.g., Sunday in US, Monday in France. setFloat(int, float). Method in interface java.sql.PreparedStatement Set a parameter to a Java float value. setFloat(Object, float). Method in class java.lang.reflect.Field Set the value of a field as a float on specified object. setFloat(Object, int, float). Static method in class java.lang.reflect.Array Sets the value of the indexed component of the specified array object to the specified float

ww w. ja

va
403

dil

i.c o

m

404
value. setFollowRedirects(boolean). Static method in class java.net.HttpURLConnection Sets whether HTTP redirects (requests with response code 3xx) should be automatically followed by this class. setFont(Font). Method in class java.awt.Component Sets the font of the component. setFont(Font). Method in interface java.awt.peer.ComponentPeer setFont(Font). Method in class java.awt.Graphics Sets the font for all subsequent text rendering operations. setFont(Font). Method in class java.awt.MenuComponent Sets the font to be used for this MenuItem to the specified font. setForeground(Color). Method in class java.awt.Component Sets the foreground color. setForeground(Color). Method in interface java.awt.peer.ComponentPeer setFormat(int, Format). Method in class java.text.MessageFormat Sets formats individually to use on parameters. setFormats(Format[]). Method in class java.text.MessageFormat Sets formats to use on parameters. setFullBufferUpdates(boolean). Method in class java.awt.image.MemoryImageSource Specify whether this animated memory image should always be updated by sending the complete buffer of pixels whenever there is a change. setGregorianChange(Date). Method in class java.util.GregorianCalendar Sets the GregorianCalendar change date. setGroupingSeparator(char). Method in class java.text.DecimalFormatSymbols setGroupingSize(int). Method in class java.text.DecimalFormat Set the grouping size. setGroupingUsed(boolean). Method in class java.text.NumberFormat Set whether or not grouping will be used in this format. setGuiAvailable(boolean). Static method in class java.beans.Beans Used to indicate whether of not we are running in an environment where GUI interaction is available. setHelpMenu(Menu). Method in class java.awt.MenuBar Sets the help menu to the specified menu on the menu bar. setHgap(int). Method in class java.awt.BorderLayout Sets the horizontal gap between components. setHgap(int). Method in class java.awt.CardLayout Sets the horizontal gap between components. setHgap(int). Method in class java.awt.FlowLayout Sets the horizontal gap between components. setHgap(int). Method in class java.awt.GridLayout Sets the horizontal gap between components. setHidden(boolean). Method in class java.beans.FeatureDescriptor The "hidden" flag is used to identify features that are intended only for tool use, and which should not be exposed to humans. setHints(int). Method in class java.awt.image.AreaAveragingScaleFilter Detect if the data is being delivered with the necessary hints to allow the averaging algorithm to do its work. setHints(int). Method in interface java.awt.image.ImageConsumer The ImageProducer can deliver the pixels in any order, but the ImageConsumer may be able to scale or convert the pixels to the destination ColorModel more efficiently or with higher quality if it knows some information about how the pixels will be delivered up front. setHints(int). Method in class java.awt.image.ImageFilter Filters the information provided in the setHints method of the ImageConsumer interface. setHints(int). Method in class java.awt.image.PixelGrabber The setHints method is part of the ImageConsumer API which this class must implement to retrieve the pixels. setHours(int). Method in class java.sql.Date Sets the hour of this date to the specified value. setHours(int). Method in class java.util.Date Sets the hour of this date to the specified value. setHumanPresentableName(String). Method in class java.awt.datatransfer.DataFlavor Sets the human presentable name for the data format that this DataFlavor represents. setIconImage(Image). Method in class java.awt.Frame Sets the image to display when this Frame is iconized. setIconImage(Image). Method in interface java.awt.peer.FramePeer setID(String). Method in class java.util.TimeZone Sets the time zone ID. setIfModifiedSince(long). Method in class java.net.URLConnection Sets the value of the ifModifiedSince field of this URLConnection to the specified value. setIn(InputStream). Static method in class java.lang.System Reassigns the "standard" input stream. setInDefaultEventSet(boolean). Method in class java.beans.EventSetDescriptor Mark an event set as being in the "default" set (or not). setIndex(int). Method in interface java.text.CharacterIterator Set the position to the specified position in the text and return that character. setIndex(int). Method in class java.text.ParsePosition

ww w. ja

va
404

dil

i.c o

m

405
Set the current parse position. setIndex(int). Method in class java.text.StringCharacterIterator Set the position to specified position in the text and return that character. setInfinity(String). Method in class java.text.DecimalFormatSymbols setInfo(String). Method in class java.security.Identity Specifies a general information string for this identity. setInput(byte[]). Method in class java.util.zip.Deflater Sets input data for compression. setInput(byte[]). Method in class java.util.zip.Inflater Sets input data for decompression. setInput(byte[], int, int). Method in class java.util.zip.Deflater Sets input data for compression. setInput(byte[], int, int). Method in class java.util.zip.Inflater Sets input data for decompression. setInt(int, int). Method in interface java.sql.PreparedStatement Set a parameter to a Java int value. setInt(Object, int). Method in class java.lang.reflect.Field Set the value of a field as an int on specified object. setInt(Object, int, int). Static method in class java.lang.reflect.Array Sets the value of the indexed component of the specified array object to the specified int value. setInterface(InetAddress). Method in class java.net.MulticastSocket Set the outgoing network interface for multicast packets on this socket, to other than the system default. setKeyChar(char). Method in class java.awt.event.KeyEvent setKeyCode(int). Method in class java.awt.event.KeyEvent setKeyPair(KeyPair). Method in class java.security.Signer Sets the key pair (public key and private key) for this signer. setLabel(String). Method in class java.awt.Button Sets the button with the specified label. setLabel(String). Method in interface java.awt.peer.ButtonPeer setLabel(String). Method in class java.awt.Checkbox Sets this check box's label to be the specified string. setLabel(String). Method in interface java.awt.peer.CheckboxPeer setLabel(String). Method in class java.awt.MenuItem Sets the label to be the specified label. setLabel(String). Method in interface java.awt.peer.MenuItemPeer setLayout(LayoutManager). Method in class java.awt.Container Sets the layout manager for this container. setLayout(LayoutManager). Method in class java.awt.ScrollPane Sets the layout manager for this container. setLength(int). Method in class java.net.DatagramPacket setLength(int). Method in class java.lang.StringBuffer Sets the length of this String buffer. setLenient(boolean). Method in class java.util.Calendar Specify whether or not date/time interpretation is to be lenient. setLenient(boolean). Method in class java.text.DateFormat Specify whether or not date/time parsing is to be lenient. setLevel(int). Method in class java.util.zip.Deflater Sets the current compression level to the specified value. setLevel(int). Method in class java.util.zip.ZipOutputStream Sets the compression level for subsequent entries which are DEFLATED. setLineIncrement(int). Method in class java.awt.Scrollbar setLineIncrement(int). Method in interface java.awt.peer.ScrollbarPeer setLineNumber(int). Method in class java.io.LineNumberInputStream Sets the line number to the specified argument. setLineNumber(int). Method in class java.io.LineNumberReader Set the current line number. setLocale(Locale). Method in class java.awt.Component Sets the locale of the component. setLocale(Locale). Method in class java.text.MessageFormat Constructs with the specified pattern and formats for the arguments in that pattern. setLocalPatternChars(String). Method in class java.text.DateFormatSymbols Sets localized date-time pattern characters. setLocation(int, int). Method in class java.awt.Component Moves the Component to a new location. setLocation(int, int). Method in class java.awt.Point Changes the point to have the specificed location. setLocation(int, int). Method in class java.awt.Rectangle Moves the rectangle to have the specificed location. setLocation(Point). Method in class java.awt.Component Moves the Component to a new location. setLocation(Point). Method in class java.awt.Point Changes the point to have the specificed location. setLocation(Point). Method in class java.awt.Rectangle Moves the rectangle to have the specificed location.

ww w. ja

va
405

dil

i.c o

m

406
setLog(OutputStream). Static method in class java.rmi.server.RemoteServer Log RMI calls to the output stream out. setLoginTimeout(int). Static method in class java.sql.DriverManager Set the maximum time in seconds that all drivers can wait when attempting to log in to a database. setLogStream(PrintStream). Static method in class java.sql.DriverManager Set the logging/tracing PrintStream that is used by the DriverManager and all drivers. setLong(int, long). Method in interface java.sql.PreparedStatement Set a parameter to a Java long value. setLong(Object, int, long). Static method in class java.lang.reflect.Array Sets the value of the indexed component of the specified array object to the specified long value. setLong(Object, long). Method in class java.lang.reflect.Field Set the value of a field as a long on specified object. setMaxFieldSize(int). Method in interface java.sql.Statement The maxFieldSize limit (in bytes) is set to limit the size of data that can be returned for any column value; it only applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR fields. setMaximum(int). Method in interface java.awt.Adjustable Sets the maximum value of the adjustable object. setMaximum(int). Method in class java.awt.Scrollbar Sets the maximum value for this Scrollbar. setMaximumFractionDigits(int). Method in class java.text.NumberFormat Sets the maximum number of digits allowed in the fraction portion of a number. setMaximumIntegerDigits(int). Method in class java.text.NumberFormat Sets the maximum number of digits allowed in the integer portion of a number. setMaxPriority(int). Method in class java.lang.ThreadGroup Sets the maximum priority of the group. setMaxRows(int). Method in interface java.sql.Statement The maxRows limit is set to limit the number of rows that any ResultSet can contain. setMenuBar(MenuBar). Method in class java.awt.Frame Sets the menubar for this Frame to the specified menubar. setMenuBar(MenuBar). Method in interface java.awt.peer.FramePeer setMessageDigest(MessageDigest). Method in class java.security.DigestInputStream Associates the specified message digest with this stream. setMessageDigest(MessageDigest). Method in class java.security.DigestOutputStream Associates the specified message digest with this stream. setMethod(int). Method in class java.util.zip.ZipEntry Sets the compression method for the entry. setMethod(int). Method in class java.util.zip.ZipOutputStream Sets the default compression method for subsequent entries. setMinimalDaysInFirstWeek(int). Method in class java.util.Calendar Sets what the minimal days required in the first week of the year are; For example, if the first week is defined as one that contains the first day of the first month of a year, call the method with value 1. setMinimum(int). Method in interface java.awt.Adjustable Sets the minimum value of the adjustable object. setMinimum(int). Method in class java.awt.Scrollbar Sets the minimum value for this Scrollbar. setMinimumFractionDigits(int). Method in class java.text.NumberFormat Sets the minimum number of digits allowed in the fraction portion of a number. setMinimumIntegerDigits(int). Method in class java.text.NumberFormat Sets the minimum number of digits allowed in the integer portion of a number. setMinusSign(char). Method in class java.text.DecimalFormatSymbols setMinutes(int). Method in class java.sql.Date Sets the minutes of this date to the specified value. setMinutes(int). Method in class java.util.Date Sets the minutes of this date to the specified value. setModal(boolean). Method in class java.awt.Dialog Specifies whether this Dialog is modal. setMode(int). Method in class java.awt.FileDialog Sets the mode of the file dialog. setModifiers(int). Method in class java.awt.event.KeyEvent setMonth(int). Method in class java.util.Date Sets the month of this date to the specified value. setMonth(int). Method in class java.sql.Time Sets the month of this date to the specified value. setMonths(String[]). Method in class java.text.DateFormatSymbols Sets month strings. setMultipleMode(boolean). Method in class java.awt.List Sets whether this list should allow multiple selections or not. setMultipleMode(boolean). Method in interface java.awt.peer.ListPeer setMultipleSelections(boolean). Method in class java.awt.List setMultipleSelections(boolean). Method in interface java.awt.peer.ListPeer DEPRECATED: Replaced by setMultipleMode(boolean). setMultiplier(int). Method in class java.text.DecimalFormat

ww w. ja

va
406

dil

i.c o

m

407
Set the multiplier for use in percent, permill, etc. setName(Principal, String). Method in interface java.security.acl.Acl Sets the name of this ACL. setName(String). Method in class java.awt.Component Sets the name of the component to the specified string. setName(String). Method in class java.beans.FeatureDescriptor setName(String). Method in class java.awt.MenuComponent Sets the name of the component to the specified string. setName(String). Method in class java.lang.Thread Changes the name of this thread to be equal to the argument name. setNaN(String). Method in class java.text.DecimalFormatSymbols setNanos(int). Method in class java.sql.Timestamp Set the Timestamp's nanos value setNegativePermissions(). Method in interface java.security.acl.AclEntry Sets this ACL entry to be a negative one. setNegativePrefix(String). Method in class java.text.DecimalFormat Set the negative prefix. setNegativeSuffix(String). Method in class java.text.DecimalFormat Set the positive suffix. setNextException(SQLException). Method in class java.sql.SQLException Add an SQLException to the end of the chain. setNextWarning(SQLWarning). Method in class java.sql.SQLWarning Add an SQLWarning to the end of the chain. setNull(int, int). Method in interface java.sql.PreparedStatement Set a parameter to SQL NULL. setNumberFormat(NumberFormat). Method in class java.text.DateFormat Allows you to set the number formatter. setObject(int, Object). Method in interface java.sql.PreparedStatement

Set the value of a parameter using an object; use the java.lang equivalent objects for integral values. setObject(int, Object, int). Method in interface java.sql.PreparedStatement This method is like setObject above, but assumes a scale of zero. setObject(int, Object, int, int). Method in interface java.sql.PreparedStatement

ww w. ja

Set the value of a parameter using an object; use the java.lang equivalent objects for integral values. setObject(Object). Method in interface java.beans.Customizer Set the object to be customized. setOrientation(int). Method in class java.awt.Scrollbar Sets the orientation for this Scrollbar. setOut(PrintStream). Static method in class java.lang.System Reassigns the "standard" output stream. setOutputStream(OutputStream). Method in class java.rmi.server.LogStream Set the stream to which output from this log is sent. setPageIncrement(int). Method in class java.awt.Scrollbar setPageIncrement(int). Method in interface java.awt.peer.ScrollbarPeer setPaintMode(). Method in class java.awt.Graphics Sets the logical pixel operation function to the Paint, or overwrite mode. setParameter(String, Object). Method in class java.security.Signature Sets the specified algorithm parameter to the specified value. setParent(ResourceBundle). Method in class java.util.ResourceBundle Set the parent bundle of this bundle. setParseIntegerOnly(boolean). Method in class java.text.NumberFormat Sets whether or not numbers should be parsed as integers only. setPatternSeparator(char). Method in class java.text.DecimalFormatSymbols setPercent(char). Method in class java.text.DecimalFormatSymbols setPerMill(char). Method in class java.text.DecimalFormatSymbols setPixels(int, int, int, int, ColorModel, byte[], int, int). Method in class java.awt.image.AreaAveragingScaleFilter Combine the components for the delivered byte pixels into the accumulation arrays and send on any averaged data for rows of pixels that are complete. setPixels(int, int, int, int, ColorModel, byte[], int, int). Method in class java.awt.image.CropImageFilter Determine whether the delivered byte pixels intersect the region to be extracted and passes through only that subset of pixels that appear in the output region. setPixels(int, int, int, int, ColorModel, byte[], int, int). Method in interface java.awt.image.ImageConsumer The pixels of the image are delivered using one or more calls to the setPixels method. setPixels(int, int, int, int, ColorModel, byte[], int, int). Method in class java.awt.image.ImageFilter Filters the information provided in the setPixels method of the ImageConsumer interface which takes an array of bytes. setPixels(int, int, int, int, ColorModel, byte[], int, int). Method in class java.awt.image.PixelGrabber The setPixels method is part of the ImageConsumer API which this class must implement to

va
407

dil

i.c o

m

408
retrieve the pixels. setPixels(int, int, int, int, ColorModel, byte[], int, int). Method in class java.awt.image.ReplicateScaleFilter Choose which rows and columns of the delivered byte pixels are needed for the destination scaled image and pass through just those rows and columns that are needed, replicated as necessary. setPixels(int, int, int, int, ColorModel, byte[], int, int). Method in class java.awt.image.RGBImageFilter If the ColorModel object is the same one that has already been converted, then simply passes the pixels through with the converted ColorModel. setPixels(int, int, int, int, ColorModel, int[], int, int). Method in class java.awt.image.AreaAveragingScaleFilter Combine the components for the delivered int pixels into the accumulation arrays and send on any averaged data for rows of pixels that are complete. setPixels(int, int, int, int, ColorModel, int[], int, int). Method in class java.awt.image.CropImageFilter Determine if the delivered int pixels intersect the region to be extracted and pass through only that subset of pixels that appear in the output region. setPixels(int, int, int, int, ColorModel, int[], int, int). Method in interface java.awt.image.ImageConsumer The pixels of the image are delivered using one or more calls to the setPixels method. setPixels(int, int, int, int, ColorModel, int[], int, int). Method in class java.awt.image.ImageFilter Filters the information provided in the setPixels method of the ImageConsumer interface which takes an array of integers. setPixels(int, int, int, int, ColorModel, int[], int, int). Method in class java.awt.image.PixelGrabber The setPixels method is part of the ImageConsumer API which this class must implement to retrieve the pixels. setPixels(int, int, int, int, ColorModel, int[], int, int). Method in class java.awt.image.ReplicateScaleFilter Choose which rows and columns of the delivered int pixels are needed for the destination scaled image and pass through just those rows and columns that are needed, replicated as necessary. setPixels(int, int, int, int, ColorModel, int[], int, int). Method in class java.awt.image.RGBImageFilter If the ColorModel object is the same one that has already been converted, then simply passes the pixels through with the converted ColorModel, otherwise converts the buffer of integer pixels to the default RGB ColorModel and passes the converted buffer to the filterRGBPixels method to be converted one by one. setPort(int). Method in class java.net.DatagramPacket setPositivePrefix(String). Method in class java.text.DecimalFormat Set the positive prefix. setPositiveSuffix(String). Method in class java.text.DecimalFormat Set the positive suffix. setPrincipal(Principal). Method in interface java.security.acl.AclEntry Specifies the principal for which permissions are granted or denied by this ACL entry. setPriority(int). Method in class java.lang.Thread Changes the priority of this thread. setPropagationId(Object). Method in class java.beans.PropertyChangeEvent setProperties(Hashtable). Method in class java.awt.image.CropImageFilter Passes along the properties from the source object after adding a property indicating the cropped region. setProperties(Hashtable). Method in interface java.awt.image.ImageConsumer Sets the extensible list of properties associated with this image. setProperties(Hashtable). Method in class java.awt.image.ImageFilter Passes the properties from the source object along after adding a property indicating the stream of filters it has been run through. setProperties(Hashtable). Method in class java.awt.image.PixelGrabber The setProperties method is part of the ImageConsumer API which this class must implement to retrieve the pixels. setProperties(Hashtable). Method in class java.awt.image.ReplicateScaleFilter Passes along the properties from the source object after adding a property indicating the scale applied. setProperties(Properties). Static method in class java.lang.System Sets the system properties to the Properties argument. setProperty(String, String). Static method in class java.security.Security Sets a security property. setPropertyEditorClass(Class). Method in class java.beans.PropertyDescriptor Normally PropertyEditors will be found using the PropertyEditorManager. setPublicKey(PublicKey). Method in class java.security.Identity Sets this identity's public key. setQueryTimeout(int). Method in interface java.sql.Statement The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute. setRawOffset(int). Method in class java.util.SimpleTimeZone

ww w. ja

va
408

dil

i.c o

m

409
Overrides TimeZone Sets the base time zone offset to GMT. setRawOffset(int). Method in class java.util.TimeZone Sets the base time zone offset to GMT. setReadOnly(boolean). Method in interface java.sql.Connection You can put a connection in read-only mode as a hint to enable database optimizations. setRef(RemoteStub, RemoteRef). Static method in class java.rmi.server.RemoteStub setRequestMethod(String). Method in class java.net.HttpURLConnection Set the method for the URL request, one of: GET POST HEAD OPTIONS PUT DELETE TRACE are legal, subject to protocol restrictions. setRequestProperty(String, String). Method in class java.net.URLConnection Sets the general request property. setResizable(boolean). Method in class java.awt.Dialog Sets the resizable flag. setResizable(boolean). Method in interface java.awt.peer.DialogPeer setResizable(boolean). Method in class java.awt.Frame Sets the resizable flag. setResizable(boolean). Method in interface java.awt.peer.FramePeer setRows(int). Method in class java.awt.GridLayout Sets the number of rows in this layout. setRows(int). Method in class java.awt.TextArea Sets the number of rows for this TextArea. setScale(int). Method in class java.math.BigDecimal Returns a BigDecimal whose scale is the specified value, and whose value is exactly equal to this number's. setScale(int, int). Method in class java.math.BigDecimal Returns a BigDecimal whose scale is the specified value, and whose integer value is determined by multiplying or dividing this BigDecimal's integer value by the appropriate power of ten to maintain the overall value. setScrollPosition(int, int). Method in class java.awt.ScrollPane Scrolls to the specified position within the child component. setScrollPosition(int, int). Method in interface java.awt.peer.ScrollPanePeer setScrollPosition(Point). Method in class java.awt.ScrollPane Scrolls to the specified position within the child component. setSeconds(int). Method in class java.sql.Date Sets the seconds of this date to the specified value. setSeconds(int). Method in class java.util.Date Sets the seconds of this date to the specified value. setSecurityManager(SecurityManager). Static method in class java.lang.System Sets the System security. setSeed(byte[]). Method in class java.security.SecureRandom Reseeds this random object. setSeed(long). Method in class java.util.Random Sets the seed of this random number generator using a single long seed. setSeed(long). Method in class java.security.SecureRandom Reseeds this random object, using the eight bytes contained in the given long seed. setSelectedCheckbox(Checkbox). Method in class java.awt.CheckboxGroup Sets the current choice to the specified Checkbox. setSelectionEnd(int). Method in class java.awt.TextComponent Sets the selection end to the specified position. setSelectionStart(int). Method in class java.awt.TextComponent Sets the selection start to the specified position. setShort(int, short). Method in interface java.sql.PreparedStatement Set a parameter to a Java short value. setShort(Object, int, short). Static method in class java.lang.reflect.Array Sets the value of the indexed component of the specified array object to the specified short value. setShort(Object, short). Method in class java.lang.reflect.Field Set the value of a field as a short on specified object. setShortcut(MenuShortcut). Method in class java.awt.MenuItem Set this MenuItem's MenuShortcut. setShortDescription(String). Method in class java.beans.FeatureDescriptor You can associate a short descriptive string with a feature. setShortMonths(String[]). Method in class java.text.DateFormatSymbols Sets short month strings. setShortWeekdays(String[]). Method in class java.text.DateFormatSymbols Sets short weekday strings. setSigners(Class, Object[]). Method in class java.lang.ClassLoader Sets the signers of a class. setSize(Dimension). Method in class java.awt.Component

ww w. ja

va
409

dil

i.c o

m

410
Resizes the Component to the specified dimension. setSize(Dimension). Method in class java.awt.Dimension Set the size of this Dimension object to match the specified size. setSize(Dimension). Method in class java.awt.Rectangle Set the size of this rectangle to match the specified size. setSize(int). Method in class java.util.Vector Sets the size of this vector. setSize(int, int). Method in class java.awt.Component Resizes the Component to the specified width and height. setSize(int, int). Method in class java.awt.Dimension Set the size of this Dimension object to the specified width and height. setSize(int, int). Method in class java.awt.Rectangle Set the size of this rectangle to the specified width and height. setSize(long). Method in class java.util.zip.ZipEntry Sets the uncompressed size of the entry data. setSocketFactory(RMISocketFactory). Static method in class java.rmi.server.RMISocketFactory Set the socket factory from which RMI gets sockets. setSocketFactory(SocketImplFactory). Static method in class java.net.ServerSocket Sets the server socket implementation factory for the application. setSocketImplFactory(SocketImplFactory). Static method in class java.net.Socket Sets the client socket implementation factory for the application. setSoLinger(boolean, int). Method in class java.net.Socket Enable/disable SO_LINGER with the specified linger time. setSoTimeout(int). Method in class java.net.DatagramSocket Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds. setSoTimeout(int). Method in class java.net.ServerSocket Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds. setSoTimeout(int). Method in class java.net.Socket Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds. setSourcePath(String). Method in class sun.tools.debug.RemoteDebugger Specify the list of paths to use when searching for a source file. setStartRule(int, int, int, int). Method in class java.util.SimpleTimeZone Sets the daylight savings starting rule. setStartYear(int). Method in class java.util.SimpleTimeZone Sets the daylight savings starting year. setState(boolean). Method in class java.awt.Checkbox Sets the Checkbox to the specifed boolean state. setState(boolean). Method in class java.awt.CheckboxMenuItem Sets the state of this MenuItem if it is a Checkbox. setState(boolean). Method in interface java.awt.peer.CheckboxMenuItemPeer setState(boolean). Method in interface java.awt.peer.CheckboxPeer setStrategy(int). Method in class java.util.zip.Deflater Sets the compression strategy to the specified value. setStrength(int). Method in class java.text.Collator Sets this Collator's strength property. setString(int, String). Method in interface java.sql.PreparedStatement Set a parameter to a Java String value. setStub(AppletStub). Method in class java.applet.Applet Sets this applet's stub. setSystemScope(IdentityScope). Static method in class java.security.IdentityScope Sets the system's identity scope. setTcpNoDelay(boolean). Method in class java.net.Socket Enable/disable TCP_NODELAY (disable/enable Nagle's algorithm). setText(CharacterIterator). Method in class java.text.BreakIterator Set a new text for scanning. setText(String). Method in class java.text.BreakIterator Set a new text string to be scanned. setText(String). Method in class java.awt.Label Sets the text for this label to the specified text. setText(String). Method in interface java.awt.peer.LabelPeer setText(String). Method in class java.awt.TextComponent Sets the text of this TextComponent to the specified text. setText(String). Method in interface java.awt.peer.TextComponentPeer setTime(Date). Method in class java.util.Calendar Sets this Calendar's current time with the given Date. setTime(int, Time). Method in interface java.sql.PreparedStatement Set a parameter to a java.sql.Time value. setTime(long). Method in class java.sql.Date Set a Date using a milliseconds time value setTime(long). Method in class java.util.Date Sets this date to represent the specified number of milliseconds since January 1, 1970 00:00:00 GMT. setTime(long). Method in class java.sql.Time Set a Time using a milliseconds time value setTime(long). Method in class java.util.zip.ZipEntry Sets the modification time of the entry.

ww w. ja

va
410

dil

i.c o

m

411
setTimeInMillis(long). Method in class java.util.Calendar Sets this Calendar's current time from the given long value. setTimestamp(int, Timestamp). Method in interface java.sql.PreparedStatement Set a parameter to a java.sql.Timestamp value. setTimeZone(TimeZone). Method in class java.util.Calendar Sets the time zone with the given time zone value. setTimeZone(TimeZone). Method in class java.text.DateFormat Sets the time zone for the calendar of this DateFormat object. setTitle(String). Method in class java.awt.Dialog Sets the title of the Dialog. setTitle(String). Method in interface java.awt.peer.DialogPeer setTitle(String). Method in class java.awt.Frame Sets the title for this Frame to the specified title. setTitle(String). Method in interface java.awt.peer.FramePeer setTransactionIsolation(int). Method in interface java.sql.Connection You can call this method to try to change the transaction isolation level using one of the TRANSACTION_* values. setTTL(byte). Method in class java.net.DatagramSocketImpl Set the TTL (time-to-live) option. setTTL(byte). Method in class java.net.MulticastSocket Set the default time-to-live for multicast packets sent out on this socket. setUnicast(boolean). Method in class java.beans.EventSetDescriptor Mark an event set as unicast (or not). setUnicodeStream(int, InputStream, int). Method in interface java.sql.PreparedStatement When a very large UNICODE value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.InputStream. setUnitIncrement(Adjustable, int). Method in interface java.awt.peer.ScrollPanePeer setUnitIncrement(int). Method in interface java.awt.Adjustable Sets the unit value increment for the adjustable object. setUnitIncrement(int). Method in class java.awt.Scrollbar Sets the unit increment for this scrollbar. setUpdateRect(Rectangle). Method in class java.awt.event.PaintEvent Sets the rectangle representing the area which needs to be repainted in response to this event. setURL(URL, String, String, int, String, String). Method in class java.net.URLStreamHandler Sets the fields of the URL argument to the indicated values. setURLStreamHandlerFactory(URLStreamHandlerFactory). Static method in class java.net.URL Sets an application's URLStreamHandlerFactory. setUseCaches(boolean). Method in class java.net.URLConnection Sets the value of the useCaches field of this URLConnection to the specified value. setValue(Adjustable, int). Method in interface java.awt.peer.ScrollPanePeer setValue(int). Method in interface java.awt.Adjustable Sets the current value of the adjustable object. setValue(int). Method in class java.awt.Scrollbar Sets the value of this Scrollbar to the specified value. setValue(Object). Method in interface java.beans.PropertyEditor Set (or change) the object that is to be edited. setValue(Object). Method in class java.beans.PropertyEditorSupport Set (or change) the object that is to be edited. setValue(String, Object). Method in class java.beans.FeatureDescriptor Associate a named attribute with this feature. setValues(int, int, int, int). Method in class java.awt.Scrollbar Sets the values for this Scrollbar. setValues(int, int, int, int). Method in interface java.awt.peer.ScrollbarPeer setVgap(int). Method in class java.awt.BorderLayout Sets the vertical gap between components. setVgap(int). Method in class java.awt.CardLayout Sets the vertical gap between components. setVgap(int). Method in class java.awt.FlowLayout Sets the vertical gap between components. setVgap(int). Method in class java.awt.GridLayout Sets the vertical gap between components. setVisible(boolean). Method in class java.awt.Component Shows or hides the component depending on the boolean flag b. setVisible(boolean). Method in interface java.awt.peer.ComponentPeer setVisibleAmount(int). Method in interface java.awt.Adjustable Sets the length of the proportionl indicator of the adjustable object. setVisibleAmount(int). Method in class java.awt.Scrollbar Sets the visible amount of this Scrollbar, which is the range of values represented by the width of the scroll bar's bubble. setWeekdays(String[]). Method in class java.text.DateFormatSymbols Sets weekday strings. setXORMode(Color). Method in class java.awt.Graphics Sets the logical pixel operation function to the XOR mode, which alternates pixels between the current color and a new specified XOR alternation color. setYear(int). Method in class java.util.Date

ww w. ja

va
411

dil

i.c o

m

412
Sets the year of this date to be the specified value plus 1900. setYear(int). Method in class java.sql.Time Sets the year of this date to be the specified value plus 1900. setZeroDigit(char). Method in class java.text.DecimalFormatSymbols setZoneStrings(String[][]). Method in class java.text.DateFormatSymbols Sets timezone strings. SHIFT_MASK. Static variable in class java.awt.event.ActionEvent The shift modifier constant. SHIFT_MASK. Static variable in class java.awt.Event The shift modifier constant. SHIFT_MASK. Static variable in class java.awt.event.InputEvent The shift key modifier constant. shiftDown(). Method in class java.awt.Event Checks if the shift key is down. shiftLeft(int). Method in class java.math.BigInteger Returns a BigInteger whose value is (this << n). shiftRight(int). Method in class java.math.BigInteger Returns a BigInteger whose value is (this >> n). SHORT. Static variable in class java.text.DateFormat Constant for short style pattern. Short(short). Constructor for class java.lang.Short Constructs a Short object initialized to the specified short value. Short(String). Constructor for class java.lang.Short Constructs a Short object initialized to the value specified by the String parameter. shortcuts(). Method in class java.awt.MenuBar Get an Enumeration of all MenuShortcuts this MenuBar manages. shortValue(). Method in class java.lang.Byte Returns the value of this Byte as a short. shortValue(). Method in class java.lang.Double Returns the value of this Double as a short (by casting to a short). shortValue(). Method in class java.lang.Float Returns the value of this Float as a short (by casting to a short). shortValue(). Method in class java.lang.Integer Returns the value of this Integer as a short. shortValue(). Method in class java.lang.Long Returns the value of this Long as a short. shortValue(). Method in class java.lang.Number Returns the value of the specified number as a short. shortValue(). Method in class java.lang.Short Returns the value of this Short as a short. show(). Method in class java.awt.Component show(). Method in interface java.awt.peer.ComponentPeer DEPRECATED: Replaced by setVisible(boolean). show(). Method in class java.awt.Dialog Shows the dialog. show(). Method in class java.awt.Window Shows the Window. show(boolean). Method in class java.awt.Component show(Component, int, int). Method in class java.awt.PopupMenu Shows the popup menu at the x, y position relative to an origin component. show(Container, String). Method in class java.awt.CardLayout Flips to the specified component name in the specified container. show(Event). Method in interface java.awt.peer.PopupMenuPeer showDocument(URL). Method in interface java.applet.AppletContext Replaces the Web page currently being viewed with the given URL. showDocument(URL, String). Method in interface java.appl