You are on page 1of 438

1

o m
i.c
JAVA PROGRAMLAMA DİLİ
(1.1 SÜRÜMÜ)

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

1
2

İNDEKS

m
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

o
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)

i.c
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ı

dil
BÖLÜM 2 : METOTLAR VE OBJECT KULLANIMI
2.1 Java API Kütüphanesi
2.2 Metotlar
va
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

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


ja

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ı
w.

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
ww

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ı

2
3

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


İNTERFACE

m
5.1 Abstract sınıf
5.2 Interface

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

o
6.1 Graphics sınıfı
6.2 Renk kontrolü

i.c
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

dil
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ı
va
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
ja

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ı
w.

8. JAVADA HATA ANALİZİ VE YAKALANMASI

9. PARELEL KULLANIM (MULTITHREADING)

10. JAVA GİRDİ - ÇIKTI PROGRAMLANMASI


ww

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

3
4

11.1 Vector Sınıfı

m
12 ÖRNEKLERLE SAYISAL ANALİZ

EK A TEXT SINIFI
EK B JAVA KÜTÜPHANESİ İNDEKSİ
EK C JAVADA KULLANILAN METODLARIN LİSTESİ

o
i.c
dil
ja va
w.
ww

4
5

JAVA PROGRAMLAMA DİLİ

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

o
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

i.c
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

yaşama umudu sağladı.


dil
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

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
va
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
ja

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.
w.

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
ww

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

5
6

ç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.

m
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.

o
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

i.c
(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.

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

dil
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.
va
Şü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.
ja

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
w.

Console)

javac isim.java

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
ww

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 :

6
7

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

m
</applet>
</html>

daha sonra bu dosya konsoldan


appletviewer isim.html

o
komutuyla çalıstırılabilir. Yahut herhangi bir browser programına yüklenerek görülebilir.

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

i.c
kolaylaştırmak amacıyla verilmiştir.

1: import java.io.*; //java girdi cikti sinifini cagir


2:
3: class Hosgeldiniz
4: {

dil
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ı
va
bu programı çalıştırmak için

javac Hosgeldiniz.java
java Hosgeldiniz

komutlarını konsolda vermemiz yeterlidir


konsol çıktısı olarak:
ja

Java Sinifina Hos Geldiniz!

Yazısını alırız.
w.

Ş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 :
ww

/* 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

7
8

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.

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

public static void main(String args[]) diğer dillerde fonksiyon (function), subroutine,

o
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.

i.c
public metoda dışarıdan ulaşılabilme izni verir.

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.

2: import java.awt.*;
3:
dil
İlk applet programımız HosgeldinizApplet.java listesi Şekil 1.2.2 de verilmiştir

1: import java.applet.Applet;

4: public class HosgeldinizApplet extends Applet


5: {
va
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ı
ja

bu programı çalıştırmak için

javac HosgeldinizApplet.java
appletviewer HosgeldinizApplet.html
w.

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.
ww

8
9

m
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.*;

o
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

i.c
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.

g.drawString("Java sinifina hos geldiniz!",25,35); Bu terim Appletin x = 25, y=35

dil
noktasına Java sinifina hos geldiniz! Yazısını çizer. DrawString Grafik sınıfı g nesnesine ait
bir metotdur.

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
va
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:
ja

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.
w.

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
ww

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

9
10

Aşağıdaki küçük program parçası mantık değişkeni ilk mantık değiskeni'ni tanımlamakta ve

m
doğru değerini bu değişkene yüklemektedir.

boolean ilkmantıkdegiskeni;
ilkmantikdegiskeni=true;
1.3.2 char (harf) değişken türü

o
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

i.c
0 0 0000
1 1 0001
2 2 0010
3 3 0011
4 4 0100
5 5 0101

dil
6 6 0110
7 7 0111
8 8 1000
9 9 1001
A 10 1010
B 11 1011
C 12 1100
va
D 13 1101
E 14 1110
F 15 1111

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
ja

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.

char A1,A2;
w.

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

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

10
11

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ı

m
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.

o
int ilktamsayi;
ilktamsayi=32;

bu iki satırlık program parçacığı tek bir satır olarak

i.c
int ilktamsayi=32;

şeklinde de yazılabilirdi.

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

0
16
1
8
0
22
4
1
21
2
1
20
1
0
dil
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 23 2-1
0.5
1
2-2
0.25
0
2-3
0.125
1
2-4
00.065
0
+\- 24

1
16
1
23
8
0
22
4
0
21
2
0
20
1
1
va
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.
ja

Double ilkgerçekdegisken;
ilkgerceldegisken=22.625e-7;

1.3.5 String değişkeni


w.

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";
ww

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.

11
12

1.4 Aritmetik işlemler

m
Javadaki temel aritmetik işlemler şunlardır :
+ toplama
- çıkarma
* çarpma
/ bölme

o
% 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.

i.c
1: import java.io.*; //java girdi cikti sinifini cagir
2:
3: class Aritmetik
4: {
5: public static void main(String args[])
6: {
7:
8:
9:
10:
11:
12:
13:
int sayi1,sayi2;

sayi2=3;
toplama = sayi1+sayi12;
cikarma = sayi1-sayi2;
carpma = sayi1*sayi2;
dil
int toplama,cikarma,carpma,bolme,kalan;
sayi1=2;
va
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);
ja

20: System.out.println("sayi1 % sayi2 ="+kalan);


21: }
22: }
Şekil 1.4.1 Aritmetik.java konsol programı
w.

sayi1 + sayi2 =5
sayi1 - sayi2 =-1
sayi1 * sayi2 =6
sayi1 / sayi2 =0
sayi1 % sayi2 =2
Şekil 1.4.2 Aritmetik.java konsol programı çıktısı
ww

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 :

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

12
13

/= sağ taraftaki rakama böl


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

m
++ 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.

o
int a=2;
int c;
c=a++; // a nın değeri 3 c nin değeri 2

i.c
Ş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ı

dil
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.

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

import java.io.*;
public class Aritmetik1
{ public static void main(String[] args)
{
ja

int sayi1=1;
int sayi2=2;
sayi1+=sayi2;
System.out.println("sayi1+= : "+ sayi1);
sayi1-=sayi2;
w.

System.out.println("sayi1-= : "+ sayi1);


sayi1*=sayi2;
System.out.println("sayi1*= : "+ sayi1);
sayi1/=sayi2;
System.out.println("sayi1/= : "+ sayi1);
ww

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

sayi1+= : 3
sayi1-= : 1
sayi1*= : 2

13
14

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

m
1.5 Javada Mantıksal işlemler

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

o
mantıksal işlemlerde kullanılabilirler. Mantıksal işlem işlemcileri şunlardır :

Mantıksal İşlemci Anlamı


&& ve

i.c
|| 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

dil
Ş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.*;
va
public class booleanvar
{ public static void main(String[] args)
{
boolean b1,b2;
b1=true;
b2=false;
ja

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;
w.

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 );
ww

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);

14
15

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


}

m
}
Şekil 1.5.2 Java mantıksal işlemleri örnek problemi booleanvar.java

b1 : true b2 : false

o
b1 && b2 false
b1 || b2 true
sayi 1 : 1
sayi 2 : 2

i.c
1 > 2 false
1 < 2 true
1 == 2 false
1 >= 2 false
1 <= 2 true
1 != 2 true

1.6 Java Dilinin temel komutları


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

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.
va
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}
ja

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}
w.

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

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

15
16

System.out.println("Ogrencinin notunu giriniz : ");


not=Text.readDouble(cin);

m
if( not >= 90)
{ System.out.println("A"); }
else if(not >=75)
{ System.out.println("B"); }
else if(not >=60)

o
{ System.out.println("C"); }
else if(not >=50)
{ System.out.println("D"); }
else if(not >=40)

i.c
{ System.out.println("E"); }
else
{ System.out.println("F"); }
}
}
Şekil 1.6.1.1 if yapısını gösteren ifyapisi.java programı

Ogrencinin notunu giriniz :


53
D
dil
Şekil 1.6.1.1 if yapısını gösteren ifyapisi.java programının çıktısı

Bu programda öğrenci notu girdi olduğundan girilen nota göre bilgisayar A,B,C,D,E veya F
va
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.

Şekil 1.6.1.2 deki program parçası a degiskeninin degeri : true yazısını yazdıracaktır.

boolean a=true;
if(a)
ja

{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ı.
w.

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;
ww

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

16
17

{
if(y>5) { System.out.println("x besten kucuktur veya esittir ve y 5 den buyuktur.");}

m
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.");
}
}
Şekil 1.6.1.3 İç içe geçmiş if yapısı

o
double x = 7.0;
double y = 3.0;
if(x > 5 && y> 5) { System.out.println("x ve y besten buyuktur.");}

i.c
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.");}
}
}

dil
Şekil 1.6.1.4 && (ve) deyimiyle bağlanmış 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.

1.6.2 while tekrarlama yapısı


va
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}
ja

örneğin :

while(true)
w.

{ 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.

int sayı=2;
while(sayı <= 1000)
ww

{ sayı *= 2; }

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.

do

17
18

{
boolean degişken veya sabitin değeri true olduğunda yapılan işlemler.

m
Bu paranteze boolean değerinin ne olduğuna bakılmaksızın en az bir kere girilir
}
while( boolean değişken yada sabit)

o
Şekil 1.6.2.1 de dowhile döngüsünün kullanıldığı bir dowhileApplet.java programı
görülmektedir

i.c
import java.awt.Graphics;
import java.applet.Applet;
public class dowhileApplet
{
public void paint(Graphics g)
{

dil
int saydirici=1;
int x=25;
do {
g.drawString(Integer.toString(saydırıcı),x,25);
x += 15;
} while(++saydirici <= 10);
}
va
}
Ţekil 1.6.2.1 dowhileApplet.java

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


ja
w.

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

1.6.3 for tekrarlama yapısı

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
ww

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 }

Şekil 1.6.3.1 for tekrarlama yapısı

18
19

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

m
verilmiştir.

import java.io.*;
class foryapisi
{

o
public static void main(String args[])
{
int toplam=0;
for(int sayi=1;sayi<=100;sayi++)

i.c
{ toplam+=sayi;}
System.out.println("1 den 100 e sayilarin toplami : "+toplam);
}
}
Şekil 1.6.3.2 foryapisi.java konsol proğramı

dil
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
va
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
ja

int y=40;
g.drawString("Yil",25,25);
g.drawString("paraMiktari",100,25);
for(int yil=1; yil<=10 ; yil++)
{
w.

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;
ww

} // 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
20

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

1.6.4 switch - case yapısı

dil
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)


va
{
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.
ja

................
default :
eğer yukarıdaki case kutularından hiçbirine girilemediyse
yapılacak işlemler
w.

break;
}
Şekil 1.6.4.1 switch - case yapısı

Ş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.
ww

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
21

Label kutubasligi; //Label sinifi degiskeni (nesnesi) kutubasligi


TextField kutugirdisi;//Textfield sinifi degiskeni (nesnesi) kutugirdisi

m
char not;
int Asayisi=0,Bsayisi=0,Csayisi=0,Dsayisi=0,Esayisi=0,Fsayisi=0;
// pencereyi baslatma metodu
public void init()
{

o
kutubasligi=new Label("Ogrencinin notunu giriniz (A B C.. : ");
add(kutubasligi);//kutubasligini pencereye yaz
kutugirdisi=new TextField(5);
add(kutugirdisi);//kutuyu pencereye yerlestir

i.c
// kutuya yeni ilave edilecek komutlari bekle
// her yeni komutta actionPerformed metodunu calistir.
kutugirdisi.addActionListener(this);
}

public void paint(Graphics g)


{

dil
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);
va
}

// girdi alanindaki olan olaylari dinleme metodu


public void actionPerformed(ActionEvent e)
{
ja

//ogrencinin notunu pencereden oku


String not1=e.getActionCommand();
not=not1.charAt(0);
showStatus(""); // sonuç bolgesindeki yazıyı sil
kutugirdisi.setText(""); //kutudaki harfi sil
w.

switch(not)
{
case 'A': case 'a':
++Asayisi;
break;
case 'B': case 'b':
++Bsayisi;
ww

break;
case 'C': case 'c':
++Csayisi;
break;
case 'D': case 'd':
++Dsayisi;
break;

21
22

case 'E': case 'e':


++Esayisi;

m
break;
case 'F': case 'f':
++Fsayisi;
break;
default:

o
showStatus("yanlis not tanimlandi yeni bir not giriniz.");
break;
} // switch deyiminin sonu
repaint();//pencereyi yeniden paint metoduna gore ciz

i.c
}

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

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

dil
va
JAVA PROGRAMLAMA DİLİ
ja

HAFTA 1

ALIŞTIRMALAR

1. Notdefteri programını kullanarak Hosgeldiniz.java proğramını incele. Konsole (MS Dos) ortamında aşağıdaki
komutları kullanarak calıştır :
w.

javac Hosgeldiniz.java
java Hosgeldiniz

import java.io.*;
class Hosgeldiniz { public static void main (String args[]) {
System.out.println("Java Sinifina Hos Geldiniz!");
}
ww

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.*;

22
23

public class HosgeldinizApplet extends Applet { public void


paint(Graphics g) { g.drawString("Java sinifina hos

m
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

o
import java.io.*; //giris çikis import Text;
class ikitamsayitopla {
public static void main (String args[]) throws IOException
{

i.c
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);

dil
toplam=sayi1+sayi2;
System.out.println("Iki tam sayinin toplami : "+toplam);
}
}

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 :
va
javac tamsayitoplaApplet .java
appletviewer tamsayitoplaApplet.html

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
ja

{
//sinif degiskenleri
Label kutubasligi; //Label sinifi degiskeni (nesnesi) kutubasligi
TextField kutugirdisi;//Textfield sinifi degiskeni (nesnesi)
kutugirdisi
int sayi;
w.

int toplam;

// pencereyi baslatma metodu


public void init()
{
kutubasligi=new Label("Bir tamsayi giriniz : ");
add(kutubasligi);//kutubasligini pencereye yaz
kutugirdisi=new TextField(10);
ww

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)

23
24

{
//sayiyi pencereden oku

m
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
}

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

i.c
}
}

aşağıdaki komutları kullanarak calıştır :


javac dortArtiIslem.java
java dortArtıIslem
dil
5. Notdefteri programını kullanarak dortArtiIslem.java proğramını incele. Konsole (MS Dos) ortamında
va
import java.io.*; //giris çikis import Text;
class dortArtiIslem
{
public static void main (String args[]) throws IOException
{
int sayi1,sayi2;
ja

//
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);
w.

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
ww

// - : 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

24
25

// /= : kendisini sag tarafindakine bol


// sayi1/=3 ve sayi1=sayi1/3 ayni islemdir

m
// %= : 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

o
// sayi1-- ve sayi1=sayi1-1 ayni islemdir
// -- : kendisinden bir cikar
// --sayi1 ve sayi1=sayi1-1 ayni islemdir
boolean mantik1,mantik2;

i.c
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

dil
// < : kucuktur
// == : esittir
// >= : buyuk veya esittir
// <= : kucuk veya esittir
// ! : mantigi tersine cevirme
// != : esit degildir
// && : ve
// || : veya
mantik1=( sayi1 > sayi2 );
va
mantik2=( sayi1 < sayi2 );
System.out.println("sayi1 buyuktur sayi2 : "+mantik1);
System.out.println("sayi 1 kucuktur sayi2 : "+mantik2);
}
}

Bir tam sayi giriniz : 3


Ikinci bir tam sayi giriniz : 2
ja

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
w.

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 :
ww

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
26

Label kutubasligi; //Label sinifi degiskeni (nesnesi) kutubasligi


TextField kutugirdisi;// Textfield sinifi degiskeni (nesnesi)

m
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

o
// pencereyi baslatma metodu
// pencere ilk basladiginda
// degiskenler buradaki degerleri alirlar
public void init()

i.c
{
kutubasligi=new Label("Bir sayi giriniz : ");
add(kutubasligi);
kutugirdisi=new TextField(10);
add(kutugirdisi);
toplam=0;
carpim=1.0;
aritmetikOrtalama=0;

dil
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)
{
va
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
ja

repaint();//pencereyi yeniden paint metoduna göre ciz


}

public void paint(Graphics g)


{
// drawString Metodundaki eksen sistemi
w.

// -----------------------> 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);
ww

g.drawString("Su ana kadarki sayilarin geometrik ortalamasi :


"+geometrikOrtalama,25,80);
}
}

26
27

o m
7. Notdefteri programını kullanarak bessayıtopla.java proğramını incele. Konsole (MS Dos) ortamında aşağıdaki

i.c
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
{

dil
double sayi;
double toplam=0;
int saydirici=0;
//
DataInputStream cin=new DataInputStream(System.in);
while( saydirici < 5)
{
System.out.println("Bir tam sayi giriniz : ");
va
sayi=Text.readDouble(cin);
toplam+=sayi;
saydirici++;
}
System.out.println("sayilarin toplami : "+toplam);
}
}
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
w.

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


ww

public class StringDegisken


{
public static void main (String args[]) throws IOException
{
String s1,s2,s3,s4;
int i1;
String s;
s1="Ali ";
s2="Veli ";

27
28

s3="49";
s4=" Elli";

m
s=s1+s2+s3+s4;
System.out.println(s);
i1=49;
s=s1+s2+i1+s4;
System.out.println(s);
}
}

o
Ali Veli 49 Elli
Ali Veli 49 Elli

i.c
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

class birdenyuzeortalama
{
public static void main (String args[])
{
double sayi=1;
double toplam=0;
while( sayi <= 100)
{

}
toplam+=sayi++;
dil
va
System.out.println("sayilarin toplami : "+toplam);
System.out.println("sayilarin ortalamasi : "+toplam/100.0);
}
}

sayilarin toplami : 5050.0


sayilarin ortalamasi : 50.5
ja

JAVA PROGRAMLAMA HAFTA 2 UYGULAMA

Hafta 2 yeni java dosyalari

Aritmetik.java
w.

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
ww

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

28
29

//graphic kullanici baglantisindaki ilk degerleri tanimla


public void init()

m
{
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

o
add(soru2); //soru2 yazisini applete cizer
girdi2.addActionListener(this);
// soru2 den sonra girdi (return) tusunu bekler
// girdi(return) tusundan sonra actionPerformed

i.c
// metoduna gider
add(girdi2); //girdi2 kutusunu applete cizer
}

// sonuclari applete yazdir


public void paint(Graphics g)
{
g.drawString("Karsilastirma sonuclari : ",70,75);

dil
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)
va
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)
ja

{
// sayi 1 i girdi kutusundan oku
sayi1=Integer.parseInt(girdi1.getText());
// sayi 2 i girdi kutusundan oku
sayi2=Integer.parseInt(girdi2.getText());
repaint();
w.

}
}
ww

29
30

o m
i.c
whileyapisi.java

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


class whileyapisi

dil
{ public static void main(String args[])
{
int sayi=2;
while(sayi<=1000)
{
sayi*=2;
System.out.println("sayi = "+sayi);
}//while yapisinin sonu
va
}
}

sayi = 4
sayi = 8
sayi = 16
sayi = 32
sayi = 64
ja

sayi = 128
sayi = 256
sayi = 512
sayi = 1024

dowhileApplet.java
w.

foryapisi.java
faizOraniApplet.java
switchApplet.java

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

Ödev problem 1
ww

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.

30
31

JAVA PROGRAMLAMA DİLİ


HAFTA 3

m
Bu haftaki yeni java dosyaları

YILDIZ~1 JAV 324 03/05/98 20:55 yildiz3forApplet.java

o
import java.awt.Graphics;import java.applet.Applet;
public class yildiz3forApplet extends Applet
{
public void paint(Graphics g)

i.c
{
int x,y;
for(y=15;y <= 150;y+=15)
{
for(x=15;x <= y;x+=15)
{
g.drawString("*",x,y);
}

dil
}
}
}
ja va

YILDIZ~2 JAV 366 02/05/98 23:37 yildiz1whileApplet.java


w.

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


public class yildiz1whileApplet extends Applet
{
public void paint(Graphics g)
{
int i=1;
int x=15;
ww

while(i++ <= 11) //i degeri birden 11 a kadar degisir


{
g.drawString("*",x,x);
x += 15; // x degeri her i icin 15 artiyor
}
}
}

31
32

o m
i.c
YILDIZ~3 JAV 404 02/05/98 23:36 yildiz2forApplet.java

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


public class yildiz2forApplet extends Applet{ public void paint(Graphics
g) { int i;

dil
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));
}
}
}
ja va
w.

YILDIZ~4 JAV 698 03/05/98 1:13 yildiz2whileApplet.java


ww

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

32
33

while(i++ <= 11) //i degeri birden 11 a kadar degisir


{

m
x += 15; // x degeri her i icin 15 artiyor
g.drawString("*",x,15); // x lineer degisken y 15
g.drawString("*",15,x); // x 15 y lineer de§isken
g.drawString("*",x,165); // x lineer degisken y 165
g.drawString("*",165,x); // x 165 y lineer de§isken
g.drawString("*",x,x); // \ ciz
g.drawString("*",x,(180-x)); // / ciz

o
}
}
}

i.c
dil
va
YILDIZ~5 JAV 366 02/05/98 23:10 yildiz1forApplet.java
ja

import java.awt.Graphics;
import java.applet.Applet;
public class yildiz1forApplet extends Applet
{
public void paint(Graphics g)
w.

{
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
ww

}
}
}

33
34

o m
i.c
KILO~1 JAV 556 02/05/98 13:18 kilo.java

import java.io.*; // giris çikis


import Text; // okuma sinifi

class kilo
{

double kilo; // dil


public static void main (String args[]) throws IOException
{

DataInputStream cin=new DataInputStream(System.in);


System.out.println("kilonuzu giriniz : ");
kilo=Text.readDouble(cin);
va
if( kilo <= 40)
{ System.out.println("zayif"); }
else if( kilo>40 && kilo<80 )
{ System.out.println("normal"); }
else
{ System.out.println("sisman"); }
}
}
ja

kilonuzu giriniz : 45
normal

kilonuzu giriniz : 95
sisman
w.

PIAPPL~1 JAV 369 03/05/98 21:27 piApplet.java

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


public class piApplet extends Applet
{
ww

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
35

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

m
}

o
ALIŞTIRMALAR

i.c
1. Java applet programı kullanarak aşağıdaki şekli applet de çizdiriniz :

**********
*********
********
*******
******

dil
*****
****
***
**
*

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


public class H3A1 extends Applet
va
{
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);
ja

}
}
}
}
w.
ww

35
36

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

m
**********
* *
* *
**********

import java.awt.Graphics;

o
import java.applet.Applet;

public class H3A2 extends Applet


{

i.c
public void paint(Graphics g)
{
int x,y;
for(x=15;x <= 150;x+=15)
{
g.drawString("*",x,15);
g.drawString("*",x,60);
}

dil
for(y=15;y <= 60;y+=15)
{
g.drawString("*",15,y);
g.drawString("*",150,y);
}

}
}
ja va

3. java konsol programı kullanarak bir sayinin faktoriyelini hesaplayiniz.


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

import java.io.*;
import Text;
class faktoriyel
{
public static void main(String args[]) throws IOException
{
long faktoriyel=1;
ww

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);
}
}

36
37

m
Bir tamsayi giriniz: 4
4 faktoriyel: 24

4. Java konsol programı kullanarak asağıdaki formulü hesaplayınız

ex = 1 + x /1! + x2 / 2! + x3 / 3! + x4 / 4! + ..

o
not : e=2.7182818

import java.io.*;
import Text;

i.c
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;
}
dil
va
System.out.println("exp("+x+") = "+exponent);
System.out.println("gercek exp("+x+") = "+Math.exp(x));
}
}

Bir sayi giriniz: 3


exp(3.0) = 20.08553692318766
ja

gercek exp(3.0) = 20.08553692318767


w.
ww

37
38

BÖLÜM 2 : METOTLAR VE OBJECT KULLANIMI

m
2.1 Java API Kütüphanesi

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

o
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

i.c
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

dil
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
va
3.14159265358979323846 (pi) sayısına eşittir. Diğeri Math.E 2.7182818284590452354 (e)
sayısına eşittir.

Metod Tanım Örnek


Abs(x) x değişekeninin mutlak değeri Math.abs(9.2) = 9.2
türkçesi : Mutlak Math.abs(-9.2) = 9.2
ja

Ceil(x) x degişkenini bir üst tamsayıya Math.ceil(9.2) = 10


dönüştürür (türkçesi : tavan) Math.ceil(-9.8) = -9
Floor(x) x değişkenini bir alt tamsayıya Math.floor(9.2) = 9
dönüştürür. (türkçesi : taban) Math.floor(-9.8) = -10
Cos(x) x in trigonometrik cosünisü Math.cos(1.0)=0.54030230568
(x radyan cinsinden
w.

tanımlanmıştır.)
Sin(x) x in trigonometrik sinüsü Math.sin(1.0)=0.8414709840709
(x radyan cinsinden
tanımlanmıştır.)
Tan(x) x in trigonometrik tanjantı Math.tan(1.0)=1.557040724655
(x radyan cinsinden
tanımlanmıştır.)
ww

Acos(x) x in trigonometrik cosünisünün Math.acos(0.54030230568)=1.0


tersi
(sonuç radyan cinsindendir)
Asin(x) x in trigonometrik sinüsü Math.asin(0.8414709840709)=1.
(x radyan cinsinden 0
tanımlanmıştır.)
Atan(x) x in trigonometrik tanjantı 4.0*Math.atan(1.0)=3.14159265
(x radyan cinsinden 359

38
39

tanımlanmıştır.)
exp(x) e(2.7182818284590452354) nin Math.exp(1.0) =2.718281828459

m
x inci kuvveti Math.exp(2.0) =7.389056098931
Log(x) e tabanına göre logaritma Math.log(2.718281828459)=1.0
Pow(x,y) x in y inci kuvveti Math.pow(3,2)=9.0
Max(x,y) x ve y nin büyük olanı Math.max(2.3,12.7)=12.7
min(x,y) x ve y nin küçük olanı Math.min(2.3,12.7)=2.3
Random() Raslantısal sayı (0 ile 1 arasinda) Math.random() = 0 ila bir

o
arasında her sayı çıkabilir
Şekil 2.1.1 Math sınıfında(class) çalışan metotlardan bazıları

i.c
Ţ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

dil
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);
va
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
ja

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
w.

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));
ww

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));

39
40

// Math.sqrt(x) x in kare koku


System.out.println("Math.sqrt("+x+" ) = "+Math.sqrt(x));

m
// 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));
}
}
Şekil 2.1.2 Math sınıfında(class) çalışan metotlardan bazılarını gösteren

o
Matematik1.java programı

Bir gercek sayi giriniz : 9.2

i.c
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

dil
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
va
Math.sqrt(9.2 ) = 3.03315017762062
Math.max(9.2,0.6 ) = 9.2
Math.min(9.2,0.6 ) = 0.6
Şekil 2.1.3 mathematik1.java programının sonuçları

2.2 Metotlar
ja

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
w.

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ı
ww

Metodun ana gövdesi


return metod çıktı değişkeni
}
Şekil 2.2.1 Genel Metot tanımı

Örnek olarak aşağıdaki metodu verebiliriz :

40
41

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

o
return f;
}

Bu metoddaki x ve y gerçek (double) değişkenleri metodun girdi

i.c
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);
dil
va
r = 34 sonucuna ulaşılır.

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

import java.io.*;
ja

public class metotornegi1


{
// sayinin karesi static metodu
public static double kare(double x)
{
return x*x;
w.

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);
ww

System.out.println("girilen sayinin karesi : "+kare(sayi));

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

41
42

import java.applet.Applet; // java applet sinifini cagir

m
import java.awt.*; // java pencere kullanma sinifini cagir

public class metodornegi2 extends Applet


{
double sayi=5; // Gercek degisken sayi

// sayinin karesi dinamik metodu

o
public double kare(double x)
{
return x*x;
}

i.c
public void paint(Graphics g)
{
g.drawString(sayi+"nin karesi = "+kare(sayi),25,50);
}
}

dil
va
Ş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
ja

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ı)
w.

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

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

42
43

nesnelerin program içindeki tanımlanmasına göz atalım. Daha


önce tanımladığımız bazı applet programlarında nesne tanımları

m
zaten geçmişti. Örneğin daha önceki programlarımızda bilgi
okutmak için kullandığımız

DataInputStream cin=new DataInputStream(System.in);

o
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

i.c
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.

dil
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);
va
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)
ja

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.
w.

import java.applet.Applet; // java applet sinifini cagir


import java.awt.*; // java pencere kullanma sinifini cagir

class metodornegi3a
{
// sayinin karesi dinamik metodu
public double kare(double x)
{
ww

return x*x;
}
}

public class metodornegi3 extends Applet implements ActionListener


{
double sayi=5; // Gercek degisken sayi
metodornegi3a nesne1=new metodornegi3a();
public void paint(Graphics g)

43
44

{
g.drawString(sayi+"nin karesi = "+nesne1.kare(sayi),25,50);

m
}
}

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

Metodornegi3.java programında iki tane sınıf(class)

o
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

i.c
ç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ı

dil
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.

import java.applet.Applet; // java applet sinifini cagir


va
import java.awt.*; // java pencere kullanma sinifini cagir

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

}
}

public class metotornegi4 extends Applet


{
double sayi=5; // Gercek degisken sayi
w.

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ı


ww

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

44
45

sınıfları ve diğer sınıflarla değişik yollardan bilgi ve


değişken aktarımı yapabilirler

m
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

o
ve 2.2.7 de Şekil 2.2.5 de verilen programın iki ayrı dosyada
yazılımını görüyoruz.

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

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

import java.applet.Applet; // java applet sinifini cagir


import java.awt.*; // java pencere kullanma sinifini cagir
import metodornegi6; // metodornegi6 sınıfını çağır
va
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);
}
ja

Ş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)


w.

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.
ww

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.

import java.io.*;
import Text;
class faktoriyel
{

45
46

public static void main(String args[]) throws IOException


{

m
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;}

o
System.out.println(faktoriyelsayi+" faktoriyel: "+faktoriyel);
}
}
Şekil 2.3.1 Metod kullanılmadan faktoriyel hesaplayan faktoriyel.java programı

i.c
import java.io.*;
import Text;

class faktoriyel1
{

dil
public static long faktoriyel(int x)
{
long faktoriyel=1;
for(int sayi=1;sayi<=x;sayi++)
{ faktoriyel*=sayi;}
return faktoriyel;
}

public static void main(String args[]) throws IOException


va
{
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));
}
ja

}
Ş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.
w.

import java.io.*;
import Text;

class faktoriyel2
{
public static long faktoriyel(int x)
{
ww

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);

46
47

int faktoriyelsayi;
System.out.println("Bir tamsayi giriniz:");

m
faktoriyelsayi=Text.readInt(cin);
System.out.println(faktoriyelsayi+" faktoriyel:" +
faktoriyel(faktoriyelsayi));
}
}

o
Bir tamsayi giriniz: 4
4 faktoriyel:24

Şekil 2.3.3 kendi kendini çağıran (recursive) faktoriyel metodunu kullarak faktoriyel

i.c
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.

dil
2.4 Aynı adlı metodların bir arada kullanılması (overloading)

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
va
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
ja

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
w.

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
ww

aynı sınıfın içerisinde tanımlayacağız.

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

public class ayniisimliikimetod extends Applet


{

47
48

// void tipi paint metodu


public void paint( Graphics g)

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

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

i.c
}

// double tipi kare metodu


double kare(double x)
{
return x*x;
}
}

dil
Şekil 2.4.1 ayniisimliikimetod.java programı
va
Şekil 2.4.2 ayniisimliikimetod.html programıyla ayniisimliikimetod.class ın gösterilmesi

Bu programda parantez içerisinde 7 (tamsayı) verildiğinde java tamsayi metodu kare(int x),
ja

7.5(gerçek sayı) verildiğinde gerçeksayi metodu kare(double x) i çağırır.

2.5 Metod (method) ve sınıf değişkenleri

Metodların içinde kullanılan değişkenler sadece metodlara aittir. O metodun dışında tanımları
w.

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

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

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;

48
49

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

m
}

public void paint(Graphics g)


{
x = 2.5;
y = 3;
g.drawString("metod1 in disi : x = "+x+" y = "+y,25,25);

o
metod1(g);
g.drawString("metod1 in disi : x = "+x+" y = "+y,25,55);
}

i.c
}
Ş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; dil
public class metotvesinifdeg1 extends Applet
{
va
//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


{
double x;
int y;
ja

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

public void paint(Graphics g)


w.

{
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);
}
ww

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


aktarılması

49
50

Metod1 in disi : x=2.5 y=3


Metod1 in ici : x=5.5 y=6

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

Ş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

o
tekrar çağırıldığında x ve y nin değerlerinin değiştiğini görürüz.

Ş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

i.c
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

import java.io.*;

class Point1
{ dil
// nesne olarak tanimlanmasi ve adres paylasimi
//java girdi cikti sinifini cagir
import java.awt.Point; //Point sinifini cagir

public static void main(String args[])


{
//Point sinifi x,y koordinatli bir nokta tanimlar
va
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);
ja

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);
w.

// 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);
ww

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);
}
}

50
51

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


paylaşımı.

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

o
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

i.c
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);
deyimi ile ise nokta1 ve nokta2 için iki ayrı adres yaratılmıştır. Bu yüzden nokta1

JAVA PROGRAMLA DİLİ


HAFTA 4

Bu haftaki incelenecek programlar :

MATEMA~1 JAV 2.436


dil
değiştiğinde nokta2 eski değerinde kalır.

10/05/98 1:48 matematik1.java


va
METOD1~1 JAV 443 09/05/98 23:46 metod1.java
METOD1~2 JAV 1.595 10/05/98 0:42 metod1Applet.java
METOD2~1 JAV 505 10/05/98 0:11 metod2.java
METOD3~1 JAV 402 10/05/98 0:11 metod3.java
METOD3~2 JAV 184 10/05/98 0:13 metod3a.java
METOD3~3 JAV 1.683 10/05/98 0:54 metod3Applet.java
METOD4~1 JAV 377 10/05/98 0:08 metod4.java
METOD4~2 JAV 189 10/05/98 0:13 metod4a.java
ja

METOD4~3 JAV 1.514 10/05/98 1:02 metod4Applet.java


POINT1~1 JAV 1.699 10/05/98 2:17 Point1.java

Bu haftaki alistırmalar

ALISTIRMA 1
w.

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()
ww

{
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;

51
52

class H4A1b

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

o
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.

i.c
import java.io.*; // giris cikis
import H4A1a;

class H4A1c
{
//yuz zarin ortalamasi
public static void main (String args[]) throws IOException
{

dil
double ortalama;
double toplam=0;
for(int sayi=0;sayi<100;sayi++)

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

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
ja

import java.io.*; // giris cikis


import H4A1a;

public class H4A1d


{
w.

//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;
ww

zar2=0;
zar3=0;
zar4=0;
zar5=0;
zar6=0;
while(zaratimsayisi<1000)
{
zardegeri=H4A1a.zar();
switch(zardegeri)
{

52
53

case 1:
zar1++;

m
break;
case 2:
zar2++;
break;
case 3:
zar3++;
break;

o
case 4:
zar4++;
break;
case 5:

i.c
zar5++;
break;
case 6:
zar6++;
break;
}
zaratimsayisi++;
}

dil
System.out.println("toplam zar 1 sayisi : "+zar1);
System.out.println("toplam zar 2 sayisi : "+zar2);
System.out.println("toplam zar 3 sayisi : "+zar3);
System.out.println("toplam zar 4 sayisi : "+zar4);
System.out.println("toplam zar 5 sayisi : "+zar5);
System.out.println("toplam zar 6 sayisi : "+zar6);
}
}
va
ALIŞTIRMA 2

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
ja

gerekli değişiklikleri yap. Programi yeni sekliyle calıştır.

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

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;
ww

public static int zar()


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

public void init()


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

53
54

add(ilkzar); // ilk zar nesnesini pencereye ekle


ikincizar=new TextField(10);// Textfield sinifi ikincizar nesnesini yarat

m
add(ikincizar); // ikinci zar nesnesini pencereye ekle
salla=new Button("Zari salla ve at");
add(salla);
salla.addActionListener(this);
}

public void actionPerformed(ActionEvent e)

o
{
zar1=zar();
zar2=zar();
ilkzar.setText(Integer.toString(zar1));

i.c
ikincizar.setText(Integer.toString(zar2));
toplam+=(zar1+zar2);
toplamzaratisi++;
repaint();
}

public void paint( Graphics g)


{

dil
g.drawString("toplam = "+toplam+" Atilan zar sayisi =
"+toplamzaratisi,25,50);
}
}

public class H4A2b


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

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

public class H4A2c extends Applet implements ActionListener


w.

{
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()
ww

{
//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);

54
55

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

o
toplamzaratisi++;
repaint();
}

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

JAVA PROGRAMLAMA DİLİ


HAFTA 5
dil
va
Geçen Haftanın Alıştırmaları :

H4A2B~1 JAV 99 19/05/98 22:18 H4A2b.java


H4A2C~1 JAV 1.117 19/05/98 22:04 H4A2c.java
H4A1B~1 JAV 212 19/05/98 23:43 H4A1b.java
H4A1A~1 JAV 99 19/05/98 22:18 H4A1a.java
H4A1C~1 JAV 424 19/05/98 22:35 H4A1c.java
H4A1D~1 JAV 1.255 19/05/98 22:53 H4A1d.java
ja

Bu haftaki incelenecek problemler :

FAKTOR~1 JAV 448 02/05/98 22:32 faktoriyel.java

import java.io.*;
w.

import Text;
class faktoriyel
{
public static void main(String args[]) throws IOException
{
int faktoriyel=1;
DataInputStream cin=new DataInputStream(System.in);
ww

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);
}
}

55
56

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

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

public class faktoriyeltesti extends Applet


{
public void paint(Graphics g)
{

o
int y=25;
for(long i=0;i<=10;i++)
{
g.drawString(i+"! = "+faktoriyel(i),25,y);

i.c
y+=15;
}
}

public long faktoriyel(long sayi)


{
if(sayi <=1) return 1;
else return sayi*faktoriyel(sayi - 1);

dil
}

FIBONA~1 JAV 463 20/05/98 0:26 fibonachitesti1.java


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

public class fibonachitesti1 extends Applet


{
public void paint(Graphics g)
{
int y=25;
ja

for(long i=0;i<=15;i++)
{
g.drawString("Fibonachi("+i+") = "+fibonachi(i),25,y);
y+=15;
}
}
w.

public long fibonachi(long sayi)


{
if(sayi <=0) return 0;
else if(sayi ==1) return 1;
else return fibonachi(sayi - 1)+fibonachi(sayi - 2);
}
ww

56
57

o m
i.c
FIBONA~2 JAV

import java.awt.*;
1.063

import java.applet.Applet;
import java.awt.event.*;
dil
20/05/98 0:47 fibonachitesti2.java

public class fibonachitesti2 extends Applet implements ActionListener


va
{
Label rakametiketi,sonucetiketi;
TextField rakam,sonuc;

public void init()


{
rakametiketi=new Label("Bir tamsayi giriniz : ");
rakam=new TextField(10);
ja

rakam.addActionListener(this);
sonucetiketi=new Label("Fibonachi degeri : ");
sonuc=new TextField(10);
sonuc.setEditable(false);
add(rakametiketi);
add(rakam);
w.

add(sonucetiketi);
add(sonuc);
}

public void actionPerformed( ActionEvent e)


{
long sayi;
long fibonachisayisi;
ww

sayi=Long.parseLong(rakam.getText());
showStatus("Fibonachi hesaplan yor....");
fibonachisayisi=fibonachi(sayi);
showStatus("Fibonachi hesaplandi....");
sonuc.setText(Long.toString(fibonachisayisi));
}

public long fibonachi(long sayi)


{
if(sayi <=0) return 0;

57
58

else if(sayi ==1) return 1;


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

m
}

o
i.c
FAKTOR~3 JAV 522 20/05/98 1:12 faktoriyel2.java

import java.io.*;
import Text;

class faktoriyel2
{

{
if( x <= 1 )
return 1;
else
dil
public static long faktoriyel(int x)

return x * faktoriyel( x - 1);


va
}

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);
ja

System.out.println(faktoriyelsayi+" faktoriyel:" +
faktoriyel(faktoriyelsayi));
}
}
w.

Bu haftaki alıştırmalar :

ALIŞTIRMA 1

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
ww

gösterilsin.
Not : Kürenin hacmi : (4.0/3.0)*Math.PI*Math.pow(r,3);

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 H5A1 extends Applet implements ActionListener
{
// bu sinif kupun hacmini hesaplar

58
59

//=====================================================
// sinif degiskenleri

m
// 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
//=====================================================

o
// pencereyi baslatma metodu
// pencere ilk basladiginda
// degiskenler buradaki degerleri alirlar
public void init()

i.c
{
kutubasligi=new Label("Kubun yaricapini (m)giriniz : ");
add(kutubasligi);
kutugirdisi=new TextField(10);
add(kutugirdisi);
yaricap=0;
hacim=0;
kutugirdisi.addActionListener(this);

dil
}
//=====================================================
// 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);
va
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);
ja

}
//=====================================================
//kubun hacmini hesaplama metodu
public double kubunhacmi(double r)
{
return (4.0/3.0)*Math.PI*r*r*r;
w.

}
}
ww

59
60

ALIŞTIRMA 2

m
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);

import java.applet.Applet; // java applet sinifini cagir

o
import java.awt.*; // java pencere kullanma sinifini cagir
import java.awt.event.*; // java pencereyi dinleme sinifini cagir
public class H5A2 extends Applet implements ActionListener
{

i.c
// 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

dil
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
va
// 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 : ");
ja

add(kutubasligi2);
kutugirdisi2=new TextField(10);
add(kutugirdisi2);
dikkenar1=0;
dikkenar2=0;
kutugirdisi2.addActionListener(this);
w.

}
//=====================================================
// 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();
ww

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)
{

60
61

g.drawString(" hipotenus = "+hipotenus(dikkenar1,dikkenar2),25,80);


}

m
//=====================================================
//ucgenin hipotenusunu hesaplama metodu
public double hipotenus(double dk1,double dk2)
{
return Math.sqrt(dk1*dk1+dk2*dk2);
}
}

o
i.c
dil
ja va
w.
ww

61
62

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

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

Şu na kadarki bütün programlarımızda sınıf(class) yapısını kullandık. Fakat tam olarak

o
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.

i.c
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
dil
degişken türü metotadı(metod girdi değişken listesi)
va
{
//metodun içindeki hesaplanan işlemler
return çıktı_değişkeni;
}
..............

}
ja

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.
w.

Class Kutu
{
double en;
double boy;
double yukseklik;
ww

Ü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

Kutu benimkutum= new Kutu();

62
63

Benimkutum kutu türünde tanılanmış bir nesnedir. Bu nesnenin kendisinin de en boy ve

m
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 :

Benimkutum.en=1.0;

o
Ş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.*;

i.c
class Kutu
{
double en;
double boy;
double yukseklik;
}

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

Bu programın adının kututesti.java olması zorunludur. Çünki ana metod(main) kututesti


ja

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
w.

Benim kutumun hacmi : 6000.0

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
ww

adresi arasında bağlantı sağlanır. Bunu grafik olarak anlatalım :

Deyim Bilgisayar belleği


Kutu benimkutum; Null

Benimkutum
Benimkutum=new Kutu(); En

Boy

Yukseklik
63
64

Benimkutum

m
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

o
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

i.c
İ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;
}

class kututesti1
{
dil
va
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;
ja

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;
w.

System.out.println("Benim kutumun hacmi : "+hacim);


}
}
Şekil 3.2.1 Kutu sınıfı iki nesne tanımlayan kututesti1.java programı

Bu programın çıktısı :

Benim kutumun hacmi : 6000.0


ww

Benim kutumun hacmi : 750.0

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ı

64
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

m
ö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
{

o
double en;
double boy;
double yukseklik;

i.c
//kurucu metod kutu
Kutu(double e,double b,double y)
{
en=e;
boy=b;
yukseklik=y;
}

dil
}

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;
va
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);
}
}

Şekil 3.2.2 Kutu sınıfı iki nesneyi kurucu(constructor) metodu yardımıyla


ja

tanımlayan kututesti2.java programı

Bu programın çıktısı :

Benim kutumun hacmi : 6000.0


Benim kutumun hacmi : 750.0
w.

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

Kutu benimkutum1=new Kutu();

Tanımı yerini
ww

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.

65
66

3.3 Diğer metotlar

m
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.

o
import java.io.*;

class Kutu

i.c
{
double en;
double boy;
double yukseklik;

//kurucu metod kutu


Kutu(double e,double b,double y)
{

dil
en=e;
boy=b;
yukseklik=y;
}

//bu metot kutunun hacmini hesaplar


double hacim()
{
va
return en*boy*yukseklik;
}

class kututesti3
{
public static void main(String args[])
{
ja

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() );
}
}
w.

Ş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.
ww

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
67

problemi incelemiştik. Şimdi de aynıgruptan metotvesınıfdeg3.java programını inceleyelim.

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

public class metotvesinifdeg3 extends Applet


{
//buradaki degiskenler tum sinifa aittir

o
double x ;
int y ;

void metod1( Graphics g) //metoda hi‡ bir de§iŸken girmiyor


{

i.c
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);

dil
}

public void paint(Graphics g)


{
x = 2.5;
y = 3;
metod1(g);
}
va
}

Ş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
ja

yukarıdaki kurucu metot kutu

//kurucu metod kutu


Kutu(double e,double b,double y)
{
this.en=e;
w.

this.boy=b;
this.yukseklik=y;
}

ş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.
ww

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.

public class dortislemhesapmakinasi


{
//sınıf değişkenleri x1 ve x2

67
68

private double x1,x2;

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

o
// ikinci bir kurucu metot dortislemhesapmakinesi
public dortislemhesapmakinasi()
{

i.c
x1=1;
x2=1;
}

public double topla()


{
return x1+x2;
}

public double cikar()


{

}
return x1-x2;

public double carp()


{
return x1*x2;
dil
va
}

public double bol()


{
return x1/x2;
}

//bu metodla x1 in değeri değiştirilir


ja

public void ilksayigir(double y1)


{
x1=y1;
}

//bu metodla x2 nin değeri değiştirilir


w.

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)
{
ww

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

68
69

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

m
ö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.

o
dortislemhesapmakinasi.java programının x1 ve x2 değişkenlerine private sözcüğü
kullandığımız için

dortislemhesapmakinasi h = new dortislemhesapmakinasi();

i.c
h.x1 = 2.0;
h.x2 = 3.5;

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

dortislemhesapmakinasi h = new dortislemhesapmakinasi();

dil
h.ilksayigir(2.0);
h.ikincisayigir(3.5);

veya

dortislemhesapmakinasi h = new dortislemhesapmakinasi();


h.ikisayigir(2.0,3.5);
va
veya

dortislemhesapmakinasi h = new dortislemhesapmakinasi(2.0,3.5);

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


ja

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.
w.

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ı
ww

public class daire extends nokta

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.

69
70

m
public class nokta
{
protected double x, y;

public nokta(double a, double b)


{

o
noktagir(a,b);
}

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


}

i.c
public double Xoku() {
return x;
}

public double Yoku()


{
return y;
}

}
public String toString()
{

}
return "["+x+","+y+"]";
dil
Şekil 3.6.1 nokta.java programı ve nokta sınıfının tanımı.
va
import nokta;
public class daire extends nokta
{
protected double yaricap;

public daire()
ja

{
//daire kalitim yaptigi nokta sinifinin kurucu metodunu
// super deyimi ile cagirabilir.
super(0,0);
yaricapgir(0);
}
w.

public daire(double r, double a, double b)


{
super(a,b);
yaricapgir(r);

}
ww

public void yaricapgir(double r)


{
if(r >= 0.0)
yaricap=r;
else
yaricap=0.0;
}

public double yaricapoku()

70
71

{
return yaricap;

m
}

public double alan()


{
return 3.14159*yaricap*yaricap;
}

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

i.c
}
}

Ş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.

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

(composition)
dil
3.7 Sınıfları başka bir sınıfta nesne olarak çağırarak bir araya getirme

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.
va
import nokta;
public class daire1
{
protected double yaricap;
protected nokta merkez;

public daire1()
{
ja

merkez=new nokta(0,0);
yaricapgir(0);
}

public daire1(double r, double a, double b)


w.

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

public void yaricapgir(double r)


ww

{
if(r >= 0.0)
yaricap=r;
else
yaricap=0.0;
}

public double yaricapoku()


{
return yaricap;

71
72

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

public String toString()


{

o
return "Merkez = "+"["+merkez.x+","+merkez.y+"]"+
"; Yaricap="+yaricap;
}
}

i.c
Ş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

programın içinde aktarımı mümkündür.

import java.awt.Graphics;
import java.applet.Applet;
dil
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
va
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);
}
ja

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
w.

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);
ww

}
}
Ş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

72
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

m
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.

o
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

i.c
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

dil
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

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
va
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.

protected void finalize() throws Throwable


{
ja

super.finalize();
}

JAVA PROGRAMLAMA DİLİ


w.

HAFTA 6

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

Bu hafta incelenecek dosyalar :


ww

KUTUTE~1 JAV 655 24/05/98 14:58 kututesti.java


KUTUTE~2 JAV 655 24/05/98 14:58 kututesti1.java
KUTUTE~3 JAV 582 24/05/98 16:00 kututesti3.java
KUTUTE~4 JAV 611 24/05/98 15:16 kututesti2.java
DAIRE~1 JAV 809 24/05/98 20:44 daire.java
DAIRE1~2 JAV 766 24/05/98 22:07 daire1.java
DAIRET~2 JAV 665 24/05/98 22:03 dairetest.java
DAIRET~3 JAV 682 24/05/98 22:08 dairetest1.java
NOKTA~1 JAV 423 24/05/98 20:42 nokta.java
H5A1~1 JAV 2.021 24/05/98 12:32 H5A1.java

73
74

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

m
Bu haftaki alıştırmalar :

ALIŞTIRMA 1

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

o
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.

i.c
ALIŞTIRMA 2

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

dil
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.

ALIŞTIRMA 3

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.
va
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
ja

JAVA PROGRAMLAMA DİLİ


HAFTA 7

Gecen haftaki alıştırmaların çözümleri :

DOGRU~1 JAV 867 01/06/98 22:59 dogru.java


w.

import nokta;

public class dogru


{
protected nokta n1,n2;

//kurucu metod metot girdisi x1,y1,x2,y2


ww

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);

74
75

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

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

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

i.c
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
import java.io.*;
import nokta;
307

public class dogrutesti


{
dil
01/06/98 22:58 dogrutesti.java

public static void main(String args[]) throws IOException


{
va
dogru cokdogrubirdogru=new dogru(1.0,1.0,2.0,2.0);
System.out.println(cokdogrubirdogru.toString());
System.out.println("dogru boyu : "+cokdogrubirdogru.boy());
}
}
ja

([1.0,1.0],[2.0,2.0])
dogru boyu : 1.4142135623730951

DIKDOR~1 JAV 926 01/06/98 23:22 dikdortgen.java


import nokta;
w.

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)
{
ww

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);

75
76

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

public String toString()

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

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

public double cevre()


{
return 2*(n1.Xoku()-n2.Xoku())+ 2*(n1.Yoku()-n2.Yoku());

dil
}
}

DIKDOR~2 JAV 345 01/06/98 23:43 dikdortgentesti.java


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

public class dikdortgentesti extends Applet


{
public void paint(Graphics g)
{
dikdortgen cokguzelbirdikdortgen=new dikdortgen(1,1,2,2);
w.

g.drawString(cokguzelbirdikdortgen.toString(),20,20);
g.drawString("Alan : "+ cokguzelbirdikdortgen.alan(),20,35);
}
}

NOKTA~1 JAV 423 24/05/98 20:42 nokta.java


ww

public class nokta


{
protected double x, y;

public nokta()
{
noktagir(0,0);
}

76
77

public nokta(double a, double b)


{

m
noktagir(a,b);
}

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

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

i.c
y = b;
}

public void Xgir(double a)


{
x = a;
}

dil
public double Xoku()
{
return x;
}

public double Yoku()


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

Bu haftaki alıştırmalar:
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.
w.

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)


ww

{
//kurucu (constructor) metot
x1=y1;
x2=y2;
}

public dortislemhesapmakinasi()
{
//kurucu metot (constructor)

77
78

x1=1;
x2=1;

m
}

public double topla()


{
return x1+x2;
}

o
public double cikar()
{
return x1-x2;
}

i.c
public double carp()
{
return x1*x2;
}

public double bol()


{

dil
return x1/x2;
}

public void ilksayigir(double y1)


{
x1=y1;
}

public void ikincisayigir(double y2)


va
{
x2=y2;
}

public void ikisayigir(double y1,double y2)


{
x1=y1;
x2=y2;
ja

}
w.

import java.io.*; //giris çikis


import Text;
import dortislemhesapmakinasi;

class dortArtiIslem1
{
public static void main (String args[]) throws IOException
{
ww

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);

78
79

System.out.println("Iki tam sayinin toplami : "+h.topla());


System.out.println("Iki tam sayinin farki : "+h.cikar());

m
System.out.println("Iki tam sayinin carpimi : "+h.carp());
System.out.println("Iki tam sayinin bolumu : "+h.bol());
}
}

Bir sayi giriniz : 2.5

o
Ikinci bir sayi giriniz : 3.5
Iki tam sayinin toplami : 6.0
Iki tam sayinin farki : -1.0
Iki tam sayinin carpimi : 8.75

i.c
Iki tam sayinin bolumu : 0.7142857142857143

JAVA DÖNEM ÖDEVİ 1

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

dil
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.

int enbuyukortakbolen(int n, int m)


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

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.
w.

Süre : 3 Hafta. Bu alıştırma 3 hafta sonra toplanacak ve sizin için


değerlendirilecektir.

JAVA ÖRNEK PROBLEMI

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
ww

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
//===========================================

79
80

import java.io.*;

m
// 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;

o
double imaj;

// kurucu metodlar
public kompleks()

i.c
{
ger=0;
imaj=0;
}

public kompleks(double nger,double nimaj)


{
ger=nger;

dil
imaj=nimaj;
}

public kompleks(double numer)


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

public double gercek()


ja

{
return ger;
}

public double imajineri()


{
w.

return imaj;
}

public void gercekgir(double r)


{
ger=r;
}
ww

public void imajinerigir(double i)


{
imaj=i;
}

public void kompleksgir(kompleks sag)


{
ger=sag.gercek();
imaj=sag.imajineri();

80
81

m
public void kompleksgir(double nr,double ni)
{
ger=nr;
imaj=ni;
}

public double R()

o
{
//kompleks sayinin polar koordinat cap esidi
return Math.sqrt(ger*ger+imaj*imaj);
}

i.c
public double theta()
{
//kompleks sayinin polar koordinat radyan aci esidi
return Math.atan2(imaj,ger);
}

public double dtheta()

dil
{
//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();
va
}

public void cikar(kompleks sag)


{
imaj = imaj - sag.imajineri();
ger = ger - sag.gercek();
}
ja

public void carp(kompleks sag )


{
ger = ger*sag.gercek() - imaj*sag.imajineri();
imaj = ger*sag.imajineri() + imaj*sag.gercek();
}
w.

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)


ww

{
// 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;
}

81
82

public static kompleks cikar(kompleks sol, kompleks sag)

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

o
public static kompleks carp(kompleks sol, kompleks sag)
{ // iki kompleks sayinin carpimini aktar
kompleks sonuc;
sonuc=new kompleks

i.c
((sol.gercek()*sag.gercek() - sol.imajineri()*sag.imajineri()),
(sol.gercek()*sag.imajineri() + sol.imajineri()*sag.gercek()));
return sonuc;
}

public static kompleks bol(kompleks sol, kompleks sag)


{ // return division of two kompleks numbers

dil
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;
}

public static kompleks pow(kompleks sol, double sag)


va
{ // 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;
ja

public boolean kucuktur(kompleks sol,kompleks sag)


{
// less then comparison of two kompleks numbers
return (sol.R() < sag.R());
w.

public boolean kucuktur_esittir(kompleks sol,kompleks sag)


{
// less then and esittir comparison of two kompleks numbers
return (sol.R() <= sag.R());
}
ww

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

82
83

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


}

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

o
public boolean esit_degildir(kompleks sol,kompleks sag)
{
// not esittir comparison of two kompleks numbers

i.c
return sol.R() != sag.R();
}

public static String toString(kompleks value)


{
String b="";
if(Math.abs(value.imajineri())!=1)
{

dil
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 )";
va
else
b=b+"("+value.gercek()+" - i )";
}
return b;
}

public String toString()


{
ja

// yazima hazir kompleks formda String degiskeni iletir.


String b="";
if(Math.abs(imajineri())!=1)
{
if(imajineri() > 0)
b=b+"("+gercek()+" + "+imajineri()+"i )";
w.

else if(imajineri() <0 )


b=b+"("+gercek()+" - "+(-imajineri())+"i )";
else
b=b+gercek()+ " ";
}
else
{
if(imajineri() > 0)
ww

b=b+"("+gercek()+" + i )";
else if(imajineri() < 0)
b=b+"("+gercek()+" - i )";
else
b=b+gercek()+" ";
}
return b;
}
};

83
84

//kompleks sinifinin tanımının sonu

m
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
import kompleks;

public class H8A1 extends Applet implements ActionListener

o
{
//
//=====================================================
// sinif degiskenleri

i.c
// 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)

dil
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
va
// 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);
ja

kutugirdisi1=new TextField(5);
kutugirdisi1.addActionListener(this);
add(kutugirdisi1);
kutugirdisi2=new TextField(5);
kutugirdisi2.addActionListener(this);
add(kutugirdisi2);
w.

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);
ww

}
//=====================================================
// 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() );

84
85

Double sayi4=new Double(kutugirdisi4.getText() );


k1.kompleksgir(sayi1.doubleValue(),sayi2.doubleValue());

m
k2.kompleksgir(sayi3.doubleValue(),sayi4.doubleValue());
repaint();//pencereyi yeniden paint metoduna gore ciz
}
//=====================================================
// paint (boya=pencereye ciz metodu)
public void paint(Graphics g)
{

o
g.drawString("ilk sayi : "+k1.toString(),25,80);
g.drawString("ikinci sayi : "+k2.toString(),25,95);

g.drawString("iki sayinin toplami :

i.c
"+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 );
}

dil
} va
ja

Java dönem ödevinin çözümü


w.

//===========================================
// bayagikesir sinifi tanimi
// Dr. Turhan Coban
//===========================================
import java.io.*;

// sinif bayagikesir
// bu sinif bayagikesir sayilarin matematik
ww

// islemlerini tanimlar
//
class bayagikesir {
// sinif degiskenleri
int pay;
int payda;

// kurucu metodlar

85
86

public bayagikesir()
{

m
pay=0;
payda=1;
}

public bayagikesir(int npay,int npayda)


{
pay=npay;

o
payda=npayda;
}

public bayagikesir(int numer)

i.c
{
pay=numer;
payda=1;
}

public bayagikesir(bayagikesir c )
{
pay=c.Pay();

dil
payda=c.Payda();
}
// giriŸ - ‡ k Ÿ metotlar

int enbuyukortakbolen(int n,int m)


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

}
return n;
}

public void sadelestir()


{
w.

//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;
ww

}
if(payda<0)
{
sign=-sign;
payda=-payda;
}
if(payda != 0)
{
int d = enbuyukortakbolen(pay,payda);

86
87

pay=sign*(pay/d);
payda=payda/d;

m
}
else
{
System.out.println("Payda s f ra esittir");
}
}

o
public int Pay()
{
return pay;
}

i.c
public int Payda()
{
return payda;
}

public void payGir(int r)


{

dil
pay=r;
}

public void paydaGir(int i)


{
payda=i;
}

public void bayagikesirGir(bayagikesir sag)


va
{
pay=sag.Pay();
payda=sag.Payda();
}

public void bayagikesirGir(int nr,int ni)


{
pay=nr;
ja

payda=ni;
}

public void bayagikesirGir(int nr)


{
pay=nr;
w.

payda=1;
}

public void bayagikesirGir(double d)


{
// tam sayinin bayagikesir esitini y kle
// eh birazc k yaklas m var tabi
bayagikesirGir((int)d*10000,10000);
ww

sadelestir();
}

public double toDouble()


{
//bayagikesir sayinin gercek sayi esidi
return ((double)pay/(double)payda);
}

87
88

public static bayagikesir BayagikesireCevir(double d)


{

m
// 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;
}

o
public void topla(bayagikesir sag)
{

i.c
//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

dil
pay = pay + sag*payda;
sadelestir();
}

public void cikar(bayagikesir sag)


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

public void cikar(int sag)


{
//bir gercek say yla topla
pay = pay - sag*payda;
sadelestir();
ja

public void carp(bayagikesir sag )


{
//bir bayagikesir sayiyla carp
pay = pay*sag.Pay();
w.

payda = payda*sag.Payda();
sadelestir();
}

public void carp(int sag )


{
//bir gercek sayiyla carp
pay = pay*sag;
ww

sadelestir();
}

public void bol(bayagikesir sag )


{
//bir bayagikesir say yla bol
pay = pay*sag.Payda();
payda = payda*sag.Pay();
sadelestir();

88
89

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

o
public static bayagikesir topla(bayagikesir sol, bayagikesir sag)
{
// iki bayagikesir say n n toplam n return deyimiyle bayagikesir olarak
// aktar r

i.c
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;
}

dil
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);
va
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
ja

// aktar r
int r1=sag.Pay() + sol*sag.Payda();
int i1=sag.Payda();
bayagikesir sonuc;
sonuc=new bayagikesir(r1,i1);
sonuc.sadelestir();
w.

return sonuc;
}

//===================================
public static bayagikesir cikar(bayagikesir sol, bayagikesir sag)
{
// iki bayagikesir say n n toplam n return deyimiyle bayagikesir olarak
// aktar r
ww

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)

89
90

{
// bir bayagikesir ve bir Pay say n n toplam n return deyimiyle

m
bayagikesir olarak
// aktar r
int r1=sol.Pay() - sag*sol.Payda();
int i1=sol.Payda();
bayagikesir sonuc;
sonuc=new bayagikesir(r1,i1);
sonuc.sadelestir();

o
return sonuc;
}

public static bayagikesir cikar(int sol, bayagikesir sag)

i.c
{
// 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);

dil
sonuc.sadelestir();
return sonuc;
}

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

public static bayagikesir carp(bayagikesir sol, bayagikesir sag)


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

public static bayagikesir carp(bayagikesir sol, int sag)


{ // bir bayagikesir ve bir double sayinin carpimini aktar
bayagikesir sonuc;
ja

sonuc=new bayagikesir(sol.Pay()*sag,sol.Payda());
sonuc.sadelestir();
return sonuc;
}

public static bayagikesir carp(int sol, bayagikesir sag)


w.

{ // 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 sag)


ww

{ // 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)

90
91

{ // bayagikesir say y double say ya bol


bayagikesir sonuc;

m
sonuc=new bayagikesir(sol.Pay(),(sol.Payda()*sag));
sonuc.sadelestir();
return sonuc;
}

public boolean kucuktur(bayagikesir sol,bayagikesir sag)


{

o
// less then comparison of two bayagikesir numbers
return (sol.toDouble() < sag.toDouble());
}

i.c
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)


{

dil
// buyuktur then comparison of two bayagikesir numbers
return sol.toDouble() > sag.toDouble();
}

public boolean buyuktur_esittir(bayagikesir sol,bayagikesir sag)


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

public boolean esit_degildir(bayagikesir sol,bayagikesir sag)


ja

{
// not esittir comparison of two bayagikesir numbers
return sol.toDouble() != sag.toDouble();
}

public static String toString(bayagikesir value)


w.

{
String b="";
if(Math.abs(value.Payda())!=1)
{
b=b+"( "+value.Pay()+" / "+value.Payda()+" )";
}
else
{
ww

b=b+value.Pay()+" ";
}
return b;
}

public String toString()


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

91
92

if(Math.abs(Payda())!=1)
{

m
b=b+"( "+pay+" / "+Payda()+" )";
}
else
{
b=b+Pay()+" ";
}
return b;

o
}
};
//bayagikesir sinifinin taniminin sonu

i.c
Bayagıkesir sınıfı test programı bkTesti

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
import bayagikesir;

{
//

// sinif degiskenleri dil


public class bkTesti extends Applet implements ActionListener

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

// bu degiskenler tum s n fa aittir


Label kutubasligi1;
kutubasligi1
//Label sinifi degiskeni (nesnesi)
va
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
ja

TextField kutugirdisi4; // Textfield sinifi degiskeni (nesnesi)


kutugirdisi2
bayagikesir k1; // bayagikesir degisken k1
bayagikesir k2; // bayagikesir degisken k2
//=====================================================
// pencereyi baslatma metodu
// pencere ilk basladiginda
w.

// 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);
ww

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);

92
93

add(kutugirdisi3);
kutugirdisi4=new TextField(5);

m
kutugirdisi4.addActionListener(this);
add(kutugirdisi4);
}
//=====================================================
// girdi alanindaki olan olaylari dinleme metodu
// Her yeni rakam girildiginde bu metod cagirilir
public void actionPerformed(ActionEvent e)

o
{
Integer sayi1=new Integer(kutugirdisi1.getText() );
Integer sayi2=new Integer(kutugirdisi2.getText() );
Integer sayi3=new Integer(kutugirdisi3.getText() );

i.c
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)

dil
{
g.drawString("ilk sayi : "+k1.toString(),25,80);
g.drawString("ikinci sayi : "+k2.toString(),25,95);

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 :
va
"+bayagikesir.toString(bayagikesir.carp(k1,k2)),25,140 );
g.drawString("iki sayinin bolumu :
"+bayagikesir.toString(bayagikesir.bol(k1,k2)),25,155 );
}
}
ja
w.
ww

93
94

BÖLÜM 4 : Boyutlu degişken ve nesneler (Arrays)

m
4.1 Tek boyutlu değişkenler

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

o
Değişken_türü değişken_ismi[];

Şeklinde tanımlanır. Bir örnek verecek olursak

i.c
int ayın_gunleri[];

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

dil
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];
va
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;

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


ja

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

Class boyut
{
w.

Public static void main(String args[] )


{
int ayin_gunleri[]=new int[12];
ayin_gunler[0]=31;
ayin_gunler[1]=28;
ayin_gunler[2]=31;
ww

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;

94
95

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

m
}
}
Şekil 4.1.1 boyut.java programı

Bu programı daha kısa olarak yazmak için Şekil 4.1.2 de görülen şekilde bütün değişkenlerin

o
değerlerini aynı anda tanımlıyabiliriz.

Class boyut1
{

i.c
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”);
}
}

dil
Şekil 4.1.2 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
va
{
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];
ja

}
System.out.println("Ortalama = "+toplam/sayi.length);
}
}
w.

Şekil 4.1.3 Aritmetik2.java programı

Ş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.
ww

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

public class zarfrekansiApplet extends Applet implements ActionListener


{
int toplamzaratisi=0;
int toplam=0;

95
96

TextField ilkzar,ikincizar;
Button salla; //zar atma d gmesi

m
int zar1,zar2;
int zarfrekansi[];

public static int zar()


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

o
public void init()
{
//programi baslat

i.c
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);

dil
}

public void actionPerformed(ActionEvent e)


{
zar1=zar();
zar2=zar();
ilkzar.setText(Integer.toString(zar1));
ikincizar.setText(Integer.toString(zar2));
toplam+=(zar1+zar2);
va
toplamzaratisi++;
// not boyutlu degisken indeksi 0 dan basliyor.
zarfrekansi[zar1-1]++;
zarfrekansi[zar2-1]++;
repaint();
}
public void paint( Graphics g)
{
ja

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));
}
w.

}
}
ww

96
97

o m
i.c
Şekil 4.1.4 ZarfrekansiApplet.html appletinin görünümü

4.2 Tek boyutlu nesne tipi değişkenler

Örneğin :
dil
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.

kompleks sayi[]=new kompleks[5];


sayi[0]=new kompleks(1,2);
sayi[1]=new kompleks(1,-1);
va
sayi[2]=new kompleks(2,0);
sayi[3]=new kompleks(1.1,-0.5);
sayi[4]=new kompleks(1,1.5);

dogru3 n[]=new dogru3[3];


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

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

gibi.

4.3 Çok boyutlu değişkenler


w.

İ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
ww

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[0][1] b[0][2] b[0][3]


b[1][0] b[1][1] b[1][2] b[1][3]
b[2][0] b[2][1] b[2][2] b[2][3]

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

97
98

yüklüyebiliriz, ve yükleme sırasında boyutları da tayin edebiliriz.


Örneğin :

m
Int b[][] = {{1,2},{3,4}};

Terimi bize aşağıdaki tabloyu tanımlar:

1 2

o
3 4

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

i.c
İ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

dil
{
// 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);
va
ikiboyutyazdir(a2,g,85);
}

public void ikiboyutyazdir(int a[][], Graphics g,int y)


{
int x=25;
for(int i=0;i<a.length;i++)
{
ja

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

y+=15;
}
}
}

Şekil 4.3.1 İki boyutlu değişkenler örnegi ikiboyut.java


ww

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.

98
99

4.4 boyutlu değişkenlerin metodlara aktarımı

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];

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

dil
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[])
{
..........................
va
}

gibi.

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

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


ja

gibi.

JAVA PROGRAMLAMA DİLİ


w.

HAFTA 8

ARITME~1 JAV 390 07/06/98 18:47 Aritmetik2.java


NOKTA3~1 JAV 1.054 09/06/98 5:01 nokta3.java

public class nokta3


{
protected double x, y, z;
ww

//kurucu metodlar
public nokta3()
{
nokta3gir(0,0,0);
}

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


{

99
100

nokta3gir(a,b,c);
}

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

// giris cikis metodlari

o
public void nokta3gir(double a, double b,double c)
{
x = a;
y = b;

i.c
z = c;
}

public void nokta3gir(nokta3 in1)


{
x = in1.x;
y = in1.y;
z = in1.z;

dil
}

public void Xgir(double a)


{
x = a;
}

public void Ygir(double b)


{
va
y = b;
}

public void Zgir(double c)


{
x = c;
}
ja

public double Xoku()


{
return x;
}

public double Yoku()


w.

{
return y;
}

public double Zoku()


{
return z;
}
ww

public String toString()


{
return "["+x+","+y+","+z+"]";
}
}

DOGRU3~1 JAV 2.419 09/06/98 5:04 dogru3.java


public class dogru3

100
101

{
// 3 boyutlu dogru

m
nokta3 n1;
nokta3 n2;

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

o
}

public dogru3(double n1x, double n1y,double n1z,


double n2x, double n2y,double n2z)

i.c
{
n1=new nokta3(n1x,n1y,n1z);
n2=new nokta3(n2x,n2y,n2z);
}

public dogru3(nokta3 na,nokta3 nb)


{
n1=new nokta3(na.Xoku(),na.Yoku(),na.Zoku());

dil
n2=new nokta3(nb.Xoku(),nb.Yoku(),nb.Zoku());
}

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);
}
va
public void dogru3gir(nokta3 in1, nokta3 in2 )
{
n1.nokta3gir(in1.x,in1.y,in1.z);
n2.nokta3gir(in2.x,in2.y,in2.z);
}

public void n1gir(double x1,double y1,double z1)


ja

{
n1.nokta3gir(x1,y1,z1);
}

public void n1gir(nokta3 in1)


{
w.

n1.nokta3gir(in1.x,in1.y,in1.z);
}

public void n2gir(double x2,double y2,double z2)


{
n2.nokta3gir(x2,y2,z2);
}
ww

public void n2gir(nokta3 in2)


{
n2.nokta3gir(in2.x,in2.y,in2.z);
}

public nokta3 n1oku()


{
return n1;
}

101
102

public nokta3 n2oku()

m
{
return n2;
}

public double X()


{
//dogrunun x koordinat uzunlugu

o
return (n2.Xoku()-n1.Xoku());
}

public double Y()

i.c
{
//dogrunun y koordinat uzunlugu
return (n2.Yoku()-n1.Yoku());
}

public double Z()


{
//dogrunun z coordinat uzunlugu

dil
return (n2.Zoku()-n1.Zoku());
}

public double aci_n1_xy()


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

public double aci_n1_yz()


ja

{
//dogrunun n1 noktas ndan y z duzlemindeki ac s
//radyan
return Math.atan2(Z(),Y());
}
w.

public double R()


{
//dogrunun boyu
return Math.sqrt(X()*X()+Y()*Y()+Z()*Z());
}

public String toString()


{
ww

return "n1: "+n1.toString()+"n2: "+n2.toString();


}
}

DORTIS~1 JAV 660 24/05/98 20:19 dortislemhesapmakinasi.java


H8A1~1 JAV 3.202 08/06/98 22:03 H8A1.java
KOMPLE~1 JAV 7.350 09/06/98 5:35 kompleks.java

102
103

Bu haftaki alıştırmalar:

ALIŞTIRMA 1

m
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.

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

o
import kompleks;

class H8A1
{

i.c
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);

dil
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());
}
va
}

Ortalama = (1.22 + 0.4i )

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


import kompleks;
ja

class H8A1a
{
public static void main(String args[]) throws IOException
{
kompleks sayi[]=new kompleks[5];
double n1,n2;
w.

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);
ww

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());
}
}

103
104

bir kompleks sayi giriniz : 1 1


bir kompleks sayi giriniz : 2 2

m
bir kompleks sayi giriniz : 3 3
bir kompleks sayi giriniz : 4 4
bir kompleks sayi giriniz : 5 5
Ortalama = (3.0 + 3.0i )

o
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

i.c
cinsinden yazdırın.

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


import kompleks;

class H8A2
{
public static void main(String args[])
{
dogru3 n[]=new dogru3[3];

dil
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++)
{
va
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());
}
}
}
ja

n1: [1.0,1.0,1.0]n2: [2.0,2.0,2.0]boy : 1.7320508075688772


aci xy = 0.7853981633974483
aci xz = 0.7853981633974483
aci yz = 0.7853981633974483
n1: [2.0,2.0,2.0]n2: [3.0,3.0,3.0]boy : 1.7320508075688772
aci xy = 0.7853981633974483
w.

aci xz = 0.7853981633974483
aci yz = 0.7853981633974483
n1: [3.0,3.0,3.0]n2: [4.0,4.0,4.0]boy : 1.7320508075688772
aci xy = 0.7853981633974483
aci xz = 0.7853981633974483
aci yz = 0.7853981633974483
ww

104
105

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


İNTERFACE

m
5.1 Abstract sınıf

Üçü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

o
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

i.c
göstermek ve onlara dolaylı yoldan ulaşmak amacıyla kullanılırlar.

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.

dil
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)
va
import sekil;

public class nokta extends sekil


{
protected double x, y;

public nokta(double a, double b)


{
ja

noktagir(a,b);
}

public void noktagir(double a, double b)


{
x=a;
w.

y=b;
}

public double Xoku()


{
return x;
}
ww

public double Yoku()


{
return y;
}

public String toString()


{
return "["+x+","+y+"]";
}

105
106

public String isimOku()

m
{
return "Nokta";
}
}
Şekil 5.1.2 Abstract sınıf sekilden kalıtımla türetilen nokta sınıfı

o
import nokta;

i.c
public class daire extends nokta
{
protected double yaricap;

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

dil
super(0,0);
yaricapgir(0);
}

public daire(double r, double a, double b)


{
super(a,b);
yaricapgir(r);
va
}

public void yaricapgir(double r)


{
if(r >= 0.0)
yaricap=r;
else
yaricap=0.0;
ja

public double yaricapoku()


{
return yaricap;
}
w.

public double alan()


{
return 3.14159*yaricap*yaricap;
}

public String toString()


{
ww

return "Merkez = "+"["+x+","+y+"]"+


"; Yaricap="+yaricap;
}

public String isimOku()


{
return "Daire";
}
}

106
107

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

m
import daire;

public class silindir extends daire


{
protected double yukseklik;
public silindir(){

o
yukseklikoku(0);}
public silindir( double h, double r, int a, int b){
super(r, a, b );
yukseklikoku( h);}
public void yukseklikoku (double h )

i.c
{
if(h>=0) yukseklik=h;
else yukseklik=0;
}
public double yukseklikoku(){return yukseklik;}

public double alan()


{

dil
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";}
}
va
Ş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;

public class abstracttesti extends Applet


{
ja

private nokta n;
private daire d;
private silindir s;
private sekil a[];

public void init()


w.

{
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;
ww

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

107
108

int y=85;
for(int i=0;i<a.length;i++)

m
{
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;
}
}

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

i.c
dil
va
Ş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ı,
ja

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
w.

bilgisayar programcılığının onemli uygulamalarından biridir.

5.2 Interface

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
ww

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.

108
109

public interface sekil


{

m
double alan();
double hacim();
String isimOku();
}

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

o
import sekil;

public class nokta implements sekil


{

i.c
protected double x, y;

public nokta(double a, double b)


{
noktagir(a,b);
}

public void noktagir(double a, double b)


{

}
x=a;
y=b;

public double Xoku()


{
return x;
dil
va
}

public double Yoku()


{
return y;
}

public double alan() {return 0.0;}


ja

public double hacim() {return 0.0;}

public String toString()


{
return "["+x+","+y+"]";
}
w.

public String isimOku()


{
return "Nokta";
}
}
ww

Ş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.

109
110

m
JAVA PROGRAMLAMA DİLİ
HAFTA 9

ALIŞTIRMA 1

Derste gördüğümüz abstract class sekil,nokta,daire, silindir sınıflarını ve ilave olarak koni

o
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.

ALIŞTIRMA 2

i.c
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.

dil
ja va
w.
ww

110
111

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

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,

o
ç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

i.c
boyutlarının belirlenmesiyle ilgili metodları içerir. Polygon sınıfı polygon çizimiyle ilgili
metodları barındırır.

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.

X ekseni

Y ekseni dil
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.
va
6.1 Graphics sınıfı

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
ja

nesne paint metodunun içinde çağırılır. Paint metodunun tanımı şöyledir

Public void paint (Graphics g)

Paint metod genellikle applet metodu tarafından otomatik olarak applet ilk açıldığında
w.

ç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

Public void repaint()

Ş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.
ww

6.1.1 drawString, drawChars ve drawBytes metodları

Bu metodların tanımları şu şekilde verilmiştir.

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

111
112

public void drawChars( char charYazı[],


int baslangıçindeksi,int yazılacakharfsayısı,

m
int x,int y)

public void drawBytes( byte byteYazı[],


int başlangıçindeksi,int yazılacakharfsayısı,
int x,int y)

o
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

i.c
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.*;

dil
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);
va
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ı


ja
w.
ww

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


Applet çıktısı

6.2 Renk kontrolü

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
113

tanımlar.
Color sınıfı kurucu metodları şu şekilden tanımlanır.

m
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

public int getRed() // Kırmızı tonunu oku

o
public int getGreen()//Yesil tonunu oku
public int getBlue()//Mavi tonunu oku
public abstract Color getColor() //rengi oku

i.c
metotları ve rengi değiştirebildiğimiz

public abstract Color setColor(Color c)

metodu mevcuttur.

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

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

public class Renk extends Applet


{
private int kirmizi,yesil,mavi;
public void init()
dil
va
{
kirmizi=100;
yesil=255;
mavi=125;
// arka palanın rengi mavi olarak veriliyor
setBackground(new Color(0,0,255));
}
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());
w.

}
}
ww

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)

113
114

Metotunu kullanarak maviye dönüştürülmüştür.

m
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.

o
import java.applet.*;
import java.awt.*;

public class stil extends Applet


{

i.c
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;
}

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

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

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


ww

public final static int BOLD : Kalın yazı sitili

public static int ITALIC : İ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.

114
115

Public Font( String s, int yazı_sitili, int harf_boyutu);

m
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 :

o
g.setFont(new Font(“Serif”,Font.BOLD,12);

Şimdi setFont metotunu küçük bir örnekte kullanarak gösterelim :

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

public class RenkFont extends Applet


{
private int kirmizi,yesil,mavi;

dil
public void init()
{
kirmizi=100;
yesil=255;
mavi=125;
}

public void paint(Graphics g)


va
{
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());
}

}
ja

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


w.

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


ww

6.4 Çizgi çizimi

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ı

115
116

int y1, //ilk noktanın y koordinatı


int x2, // ikinci noktanın x koordinatı

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

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

o
public class cizgiciz extends Applet
{
public void paint(Graphics g)

i.c
{
g.setColor(new Color(0,255,255));
g.setFont(new Font("SansSerif",Font.PLAIN,24));
g.drawLine(10,10,230,95);
}
}

dil
va
Şekil 6.4.1 Çizgi çizim örneği cizgiciz.java ve çizginin appletde görünümü

6.5 Dikdörtgen çizimi


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ı
w.

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
ww

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

116
117

metotları mevcuttur. DrawREct ve fillRec metodunun kullanımı Şekil 5.5.1 de verilmiştir.

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

public class dikdortgenCiz extends Applet


{
public void paint(Graphics g)

o
{
g.setColor(new Color(255,0,0));
g.drawRect(10,10,100,50);
g.fillRect(129,10,100,50);

i.c
}
}

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

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


va
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
ja

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ı
w.

int en, // dikdörgenin genişliği


int yukseklik, // dikdörtgenin yüksekliği
int koseeni, // yuvarlak kosenin eni
int koseyuksekligi )// yuvarlak kosenin yuksekligi

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

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);

117
118

}
}

o m
i.c
Şekil 6.5.2 yuvarlakKoseliDikdortgenCiz.java programı ve appleti

Ayrıca 3 boyutlu dikdortgen çizen draw3DRect ve fill3Drect metotları mevcutttur. Bu

dil
metotların tanımları şu şekilde verilmiştir.

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
va
boolean yukarıkaldırma) // yukarı kalkık 3üncü boyut

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
ja

boolean yukarıkaldırma) // yukarı kalkık 3üncü boyut

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

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);
ww

g.fill3DRect(120,10,100,100,true);
g.draw3DRect(10,120,100,100,false);
g.fill3DRect(120,120,100,100,false);

}
}

118
119

o m
i.c
Şekil 6.5.3 ucBoyutluDikdortgenCiz.java programı ve appleti

6.6 Oval ve açılı oval çizimi

int x1,
int y1,
dil
Oval çizimi için drawOval ve fillOval metodları kullanılır bu metodların tanımı şöyledir :

Public abstract void drawOval(


// üst tepe noktanın x koordinatı
// üst tepe noktanın y koordinatı
va
int en, // ovalin genişliği
int yukseklik) // ovalin yüksekliği

Public abstract void fillOval(


int x1, // üst tepe noktanın x koordinatı
int y1, // üst tepe noktanın y koordinatı
int en, // ovalin genişliği
ja

int yukseklik) // ovalin yüksekliği

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

(x1,y1)
w.

boy
ww

en

Şekil 6.6.1 Oval tanımı koordinat sistemi

Oval programını küçük bir örnek programda kullanalım :

import java.applet.Applet;

119
120

import java.awt.*;

m
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);

o
}
}

i.c
dil
Şekil 6.6.2 daireCiz.java programı ve apleti

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ı :
va
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
ja

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ı
w.

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 :


ww

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

public class arcCiz extends Applet


{
public void paint(Graphics g)
{
g.setColor(new Color(0,0,255));

120
121

g.setFont(new Font("SansSerif",Font.PLAIN,12));
g.drawOval(70,10,50,50);

m
g.drawArc(10,10,50,50,30,60);
g.fillArc(70,10,50,50,30,60);
}
}

o
i.c
Şekil 6.6.3 arcCiz.java programı ve apleti

6.7 Polygon çizimi

dil
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ı
va
public abstract void drawPolyline(
int x[], // x koordinat vektörü
int y[], // y koordinatı vektörü
int nokta sayısı) // nokta sayısı
ja

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

public Polygon() //Polygon sınıfı

public Polygon(
w.

int x[], // x koordinat vektörü


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

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.
ww

Örnek olarak üçgen çizen bir program verelim :


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

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
122

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};

m
int y1[];
y1=y;
g.setColor(new Color(0,0,255));
g.drawPolygon(x,y,4);
g.fillPolygon(x1,y1,4);
}
}

o
i.c
6.8 Resim gösterimi
dil
Şekil 6.7.1 ucgenCiz.java programı ve apleti

Java dili sadece .gif ve .jpg standartlarındaki resimleri gösterebilir. Bu standartlar internet
va
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.
ja

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

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

public class resim extends Applet


{
private Image bebek;
public void init()
{
bebek=getImage(getDocumentBase(),"turhan.gif");
ww

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);
}

122
123

o m
i.c
dil
ja va

JAVA PROGRAMLAMA DİLİ


HAFTA 10

CIZ~1 JAV 459 16/06/98 1:40 ciz1.java


w.

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'};
ww

private byte b[]={'b','y','t','e',75,76,77};

public void init()


{
Color c=new Color(0,0,255);
setBackground(c);

123
124

public void paint(Graphics g)


{

m
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);
}
}

o
i.c
CIZGIC~2 JAV
PLOT~1 JAV
251
8.987
dil
16/06/98
16/06/98
1:42 cizgiciz.java
1:57 Plot.java

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

public class Plot


{
ja

String label; // Plot Label


String xlabel; // X axis Label
String ylabel; // Y axis Label
String filename; // file name
double xmax,xmin,ymax,ymin; // real max,min scale
int xabsmin,yabsmin,abswidth,absheight; // absolute max,min scale
w.

int nmax; // max number of data points


int nline; // max number of data sets
double x[][]; // x data
double y[][]; // y=f(x) data
int n[]; // n : number of data in each
line
int red[],green[],blue[]; // color code 0-255
int plottype[];
ww

int xgridon;
int ygridon;
// plottype = 0 continuous line
// plottype = 10 user defined character plot
// plottype = 20 rectangle
// plottype = 21 circle
// plottype = 22 triangle
// plottype = 23 diamond
// plottype = 24 pentagon

124
125

// plottype = 25 hexagon
char ch[]; // plot character (used with plottype 10)

m
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

o
yip,double dxp,double dyp)
{
//sets rectangular plot window
xabsmin = (int)(width*(xip+0.2));

i.c
yabsmin = (int)(height*(yip+0.2));
abswidth = (int)(width*dxp);
absheight = (int)(height*dyp);
}

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
{

dil
xmin=9.99e50;
xmax=-9.99e50;
ymin=9.99e50;
ymax=-9.99e50;
xntic=8;
yntic=8;
double xtemp,ytemp;
label=pl;
xlabel=xl;
va
ylabel=yl;
nline=ifn.length;
xntic=xnt;
yntic=ynt;
xgridon=xgo;
ygridon=ygo;
n=new int[nline];
red=new int[nline];
ja

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[];
w.

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];
ww

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));

125
126

} catch(IOException e)
{

m
System.err.println("Error Opening File \n"+e.toString());
System.exit(1);
}
try{
while(ffile!=null)
{
xtemp=Text.readDouble(ffile);

o
ytemp=Text.readDouble(ffile);
if(xtemp<xmin) xmin=xtemp;
if(xtemp>xmax) xmax=xtemp;
if(ytemp<ymin) ymin=ytemp;

i.c
if(ytemp>ymax) ymax=ytemp;
n[i]++;
}
} catch(EOFException e_eof)
{
//close ffile
try{
ffile.close();

dil
} 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
{
va
if(n[i]>nmax) nmax=n[i];
}
}
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());
ja

for(i=0;i<nline;i++)
{
//open ffile
try{
ffile=new DataInputStream(new FileInputStream(lineDataFile));
} catch(IOException e)
w.

{
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);
ww

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

126
127

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

m
}

public Plot() throws IOException


{
//adding max-min prompts and input fields
//initial values of max and mins
// Structure of input file

o
// filename
// xlabel
// ylabel
// nline xntic yntic xgridon ygridon

i.c
// datafilename plottype redcolor greencolor bluecolor
// ........
// datafilename plottype redcolor greencolor bluecolor

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

dil
// 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;
va
ymin=9.99e50;
ymax=-9.99e50;
xntic=8;
yntic=8;
double xtemp,ytemp;
plotFile=new File("Plot.dat");
plotFile=new File(plotFile.getAbsolutePath());
try{
ja

fin=new DataInputStream(new FileInputStream(plotFile));


} catch(IOException e)
{
System.err.println("Error Opening File \n"+e.toString());
System.exit(1);
}
w.

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);
ww

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];

127
128

int i,j;
for(i=0;i<nline;i++)

m
{
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);

o
j=0;
n[i]=0;
//open ffile
lineDataFile=new File(fn[i]);

i.c
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);
}

dil
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;
va
n[i]++;
}
} catch(EOFException e_eof)
{
//close ffile
try{
ffile.close();
} catch(IOException e)
ja

{
System.err.println("Error Closing File\n"+e.toString());
System.exit(1);
}
} //End of EOFException
w.

if(i==0) nmax=n[i];
else
{
if(n[i]>nmax) nmax=n[i];
}
}
//close ffile
try{
ww

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

128
129

for(i=0;i<nline;i++)
{

m
//open ffile
try{
lineDataFile=new File(fn[i]);
lineDataFile=new File(lineDataFile.getAbsolutePath());
ffile=new DataInputStream(new FileInputStream(lineDataFile));
} catch(IOException e)
{

o
System.err.println("Error Opening File \n"+e.toString());
System.exit(1);
}
for(j=0;j<n[i];j++)

i.c
{
x[i][j]=Text.readDouble(ffile);
y[i][j]=Text.readDouble(ffile);

}
//close ffile
try{
ffile.close();

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

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

PLOTSH~2 JAV 11.584 16/06/98 1:57 PlotShapes.java


w.

//======================================================
// Numerical Analysis package in java
// PlotShapes class
// This class convert graphic draw methods to
// plot coordinates and gives additional plotting methods
// Dr. Turhan Coban
// =====================================================
ww

import java.io.*;
import java.applet.*;
import java.awt.*;

public class PlotShapes extends Applet


{
Graphics g;
int xabsmin,yabsmin;
int absheight,abswidth;

129
130

double xmin,xmax,ymin,ymax;

m
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

o
// absheight : absoulute height of plotting window
// abswidth : absolute width of plotting window
// xmin : minimum x value (real number)
// xmax : maximum x value (real number)

i.c
// 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;

dil
xmin=xmini;
xmax=xmaxi;
ymin=ymini;
ymax=ymaxi;
}

public void drawLine(int plottype,double x1,double y1,double x2,double y2)


{
// draw a line from (x1,y1) to (x2,y2)
va
if(plottype==0) //draw a continuous line
{
g.drawLine( (int)(xabsmin+(x1-xmin)/(xmax-xmin)*abswidth),
(int)(yabsmin+absheight-(y1-ymin)/(ymax-
ymin)*absheight),
(int)(xabsmin+(x2-xmin)/(xmax-xmin)*abswidth),
(int)(yabsmin+absheight-(y2-ymin)/(ymax-
ymin)*absheight));
ja

}
} //end of drawLine

public void drawChar(char ch,double x1,double y1)


{
w.

// 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);
ww

} //end of PlotShapes.drawChar

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)

130
131

int h=g.getFontMetrics().getHeight();
int w=h-2;

m
g.drawChars(ch,firstspace,numberofchars,
(int)((xabsmin+(x1-xmin)/(xmax-xmin)*abswidth)+5),
(int)((yabsmin+absheight-(y1-ymin)/(ymax-
ymin)*absheight)+h/2));

} //end of PlotShapes.drawChars

o
public void drawString(String s,double x1,double y1)
{
//draws a String at (x1,y1)
int h=g.getFontMetrics().getHeight();

i.c
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

public void drawRect(double x1,double y1,int rectwidth,int rectheight)

dil
{
// 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)*absheight-
rectheight/2),
rectwidth,rectheight);
va
}//end of drawRect

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),
ja

(int)(yabsmin+absheight-(y1-ymin)/(ymax-ymin)*absheight-
height/2),
width,height);
}//end of drawRect

public void drawPolygon(double x1,double y1,int radius,int side)


w.

{
//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;
ww

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;

131
132

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

m
}//end of drawPolygon

public void drawXTic(int ticNumber,double ticHeight,int ticSide)


{
//draw a series of x axis tics
double dtic=(xmax-xmin)/ticNumber;
double x1=xmin;

o
double y1=ymin;
if(ticSide==0)
{
for(int i=0;i<=ticNumber;i++)

i.c
{
drawLine(0,x1,y1,x1,(y1-ticHeight));
x1=x1+dtic;
}
}
else
{
for(int i=0;i<=ticNumber;i++)

dil
{
drawLine(0,x1,y1,x1,(y1+ticHeight));
x1=x1+dtic;
}
}
}

public void drawYTic(int ticNumber,double ticWidth,int ticSide)


va
{
//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++)
ja

{
drawLine(0,x1,y1,(x1-ticWidth),y1);
y1=y1+dtic;
}
}
else
w.

for(int i=0;i<=ticNumber;i++)
{
drawLine(0,x1,y1,(x1+ticWidth),y1);
y1=y1+dtic;
}
}
ww

public void drawXGrid(int ticNumber)


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

132
133

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

m
}
}

public void drawYGrid(int ticNumber)


{
//draw y gridlines =====
double dtic=(ymax-ymin)/ticNumber;

o
double y1=ymin;
for(int i=0;i<=ticNumber;i++)
{
drawLine(0,xmin,y1,xmax,y1);

i.c
y1=y1+dtic;
}
}

public void drawXNumbers(int ticNumber)


{
//draw x numbers
double dtic=(xmax-xmin)/ticNumber;

dil
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);
va
x1=x1+dtic;
}
}

public void drawYNumbers(int ticNumber)


{
ja

// draw y numbers
double dtic=(ymax-ymin)/ticNumber;
double x1=xmin;
double y1=ymin;
String s;
s=" ";
w.

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;
}
}
ww

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);
}

133
134

public void drawYLabel(String yLabel)

m
{
// 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);

o
// 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++)
{

i.c
drawChar(ch[i],x1,y1);
y1=y1-(ymax-ymin)/30;
}
}

public void drawLabel(String Label)


{
//draw graphic label

dil
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);
}

public void
drawPlotLines(int i,int plottype[],double x[][],double y[][],int n[],char
ch[])
va
{
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 )
ja

&& (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]);
w.

}
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)
ww

{
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];

134
135

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

m
}
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]);

o
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)

i.c
{
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

dil
//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;
va
}//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))
ja

{ 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)
{
w.

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)
ww

{
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)
}

135
136

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

//======================================================
// Numerical Analysis package in java
// PlotApplet class to plot 2D data

o
// Dr. Turhan Coban
// =====================================================
import java.io.*;
import java.applet.*;
import java.awt.*;

i.c
import java.awt.event.*;
import PlotShapes;
import Plot;

public class PlotApplet extends Applet implements ActionListener


{
Label promptXmin; // Label prompt in Xmin field
Label promptXmax; // Label prompt in Xmax field

dil
Label promptYmin; // Label prompt in Ymin field
Label promptYmax; // Label prompt in Ymax field
TextField inputXmin; // input field Xmin
TextField inputXmax; // input field Xmax
TextField inputYmin; // input field Ymin
TextField inputYmax; // input field Ymax
Plot p1;

public void init()


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

public void initplot() throws IOException


{
ja

//adding max-min prompts and input fields

//label
//xaxis
//yaxis
// 4 10 10 1 1
w.

// 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;
ww

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];

136
137

int ib[]=new int[4];


int ir[]=new int[4];

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

o
ib[0]=0;
ir[1]=0;
ig[1]=255;
ib[1]=0;

i.c
ir[2]=0;
ig[2]=255;
ib[2]=0;
ir[3]=0;
ig[3]=255;
ib[3]=0;

try{

dil
//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 ");
va
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);
ja

add(inputXmin);
add(promptXmax);
add(inputXmax);
add(promptYmin);
add(inputYmin);
add(promptYmax);
w.

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));
ww

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);

137
138

ps.drawXLabel(p1.xlabel);
ps.drawYLabel(p1.ylabel);

m
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++)
{

o
// 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

i.c
}//end of method

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();

dil
Double valYmin=new Double(inputYmin.getText());
p1.ymin=valYmin.doubleValue();
Double valYmax=new Double(inputYmax.getText());
p1.ymax=valYmax.doubleValue();
repaint();
}

}
ja va
w.
ww

Bilgi dosyası Plot.dat

label of the plot Plot başlığı


xaxis of the plot x axis başlığı

138
139

yaxis of the plot y axis başlığı


3 10 10 0 0 plot cizgi sayısı logaritmikX logaritmikY gridX gridY

m
a.dat 10 * 0 0 255 dosyaİsmi plot_türü (10 ise plot char) Kırmızı Yesil Ma
b.dat 0 255 0 0 dosyaİsmi Plot_türü Kırmızı Yesil Mavi
c.dat 0 255 100 0 dosya_ismi Plot_türü Kırmızı Yeşil Mavi

Bilgi dosyası a.dat


1 1
2 4

o
3 9
4 16
5 25
6 36

i.c
7 49

Bilgi dosyası b.dat


0 0
0.526316 0.277008
1.05263 1.10803
1.57895 2.49307

dil
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
va
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
ja

Bilgi dosyası c.dat


1 1
2 2
3 3
4 4
5 5
w.

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.
ww

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;

139
140

import java.awt.*;

m
public class resim extends Applet
{
private Image bebek;

public void init()


{
bebek=getImage(getDocumentBase(),"turhan.gif");

o
}

public void paint(Graphics g)


{

i.c
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.*;

{
public void paint(Graphics g)
{
dil
public class ucgenCiz extends Applet

int x[]={10,(int)(10+100*Math.cos(Math.PI/3.0)),110,10};
va
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);
}
ja

}
w.
ww

ALIŞTIRMA 5

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

140
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.

m
ALIŞTIRMA 6

Türkçe renkleri tanımlıyan renk sınıfını yaz.

o
i.c
dil
ja va
w.
ww

141
142

BÖLÜM 7: Grafik Applet Oluşturma Metotları, Grafik Kullanıcısı


Arabirim programları (GUI)

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

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

o
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.

i.c
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

dil
1. TextComponent
• TextField
• TextArea
2. Button
3. Label
4. Checkbox
5. List
va
6. Choice
7. Canvas
8. Scrollbar
9. Container
• Panel
Java.applet.Applet
• ScrollPane
ja

• Window
Frame
Dialog

Sınıflarını incelemeye calışacağız.


w.

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 :
ww

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
143

public void setText(String s) // Label sınıfının String değişkenine yeni değer


girer.

m
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 :

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

i.c
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);
}

public void paint(Graphics g)


{ dil
g.drawString("L1 : "+L1.getText(),25,80);
g.drawString("L2 : "+L2.getText(),25,95);
}
va
}
ja
w.

Ş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.
ww

7.3 Button (Düğme) sınıfı

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

143
144

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 :

m
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

o
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.

i.c
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

dil
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
va
2. AdjustmentListener
3. ComponentListener
4. ContainerListener
5. FocusListener
6. ItemListener
7. KeyListener
ja

8. MouseListener
9. MouseMotionListener
10. TextListener
11. WindowListener
w.

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 :

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

public class ButtonTesti extends Applet


{
private Button B1,B2;

public void init()


{
B1=new Button("B1");
B1.addActionListener(new B1Basilinca(this));
add(B1);

144
145

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

m
add(B2);
}
}

class B1Basilinca implements ActionListener


{
Applet applet;

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

public void actionPerformed(ActionEvent e)

i.c
{
applet.showStatus(" "+e.getActionCommand()+"dugmesine basildi");
}

class B2Basilinca implements ActionListener


{

dil
Applet applet;

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

public void actionPerformed(ActionEvent e)


{
applet.showStatus(" "+e.paramString()+"dugmesine basildi");
}
va
}
ja

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

import java.applet.Applet;
w.

import java.awt.*;
import java.awt.event.*;

public class ButtonTesti1 extends Applet implements ActionListener


{
private Button B1,B2;

public void init()


ww

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

145
146

public void actionPerformed(ActionEvent e)


{

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

o
Ş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

i.c
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.

dil
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.
va
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
ja

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 :

import java.applet.Applet;
w.

import java.awt.*;
import java.awt.event.*;

public class TextFieldTesti extends Applet implements ActionListener


{
private TextField T1,T2,T3,T4;

public void init()


ww

{
setBackground(Color.lightGray);
//bos textField
T1=new TextField();
T1.addActionListener(this);
add(T1);
T2=new TextField("Buraya yazi yaziniz");
T2.addActionListener(this);
add(T2);

146
147

T2=new TextField("gizli yazi");


T2.setEchoChar('*');

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

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

i.c
}

dil
ja va

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


w.

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.

7.5 TextArea(YazımAlanı) sınıfı


ww

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.

147
148

Metotları burada da aynen geçerlidir.TextArea’nınkurucu metotlarıda şöyledir:


public TextArea()

m
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)

o
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

i.c
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

import java.applet.Applet;
import java.awt.*;
dil
Şimdi TextArea metodunu Küçük bir örnekte kullanalım :

public class TextAreaTesti extends Applet


{
private TextArea T1;
public void init()
va
{
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);
ja

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
w.

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


ww

import java.applet.Applet;

148
149

import java.awt.*;
import java.awt.event.*;

m
public class TextAreaTesti1 extends Applet
implements ActionListener,TextListener
{
private TextArea T1,T2;
private Button kopye;
public void init()
{
setBackground(Color.lightGray);

o
//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);

i.c
T1.addTextListener(this);
add(T1);
kopye=new Button("Kopye >>>");
kopye.addActionListener(this);
add(kopye);
T2=new TextArea(5,20);
T2.setEditable(false);
add(T2);
}

dil
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
va
TextComponent kaynak=(TextComponent)(e.getSource());
T2.setText(kaynak.getText());
}
}
ja
w.
ww

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

149
150

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.

m
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.

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

o
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

i.c
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 listeden siler


dil
verilen stringi listeye indeks sırasındaki madde olarak ekle
public synchronised void remove(String s)

Choice (Seçim) sınıfını bir programda kullanalım :

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

public class ChoiceTesti extends Applet


{
private Choice F;
private TextField T;
public void init()
ja

{
F=new Choice();
F.add("MonoSpaced"); // Courier
F.add("SansSerif"); // Helvetica
F.add("Serif"); // Times
T=new TextField(F.getItem(0),30);
w.

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);
}
}
ww

class FontIsmiKontrolu implements ItemListener


{
private Component C;
public FontIsmiKontrolu(Component C)
{
this.C=C;
}
public void itemStateChanged(ItemEvent e)

150
151

{
C.setFont(new Font(e.getItem().toString(),

m
C.getFont().getStyle(),
C.getFont().getSize()));
}
}

class TextFieldKontrolu implements ItemListener


{

o
private TextField T;
public TextFieldKontrolu(TextField T)
{
this.T=T;

i.c
}

public void itemStateChanged(ItemEvent e)


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

dil
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.
ja va
w.
ww

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

7.7 CheckBox ve CheckBoxGroup sınıfları

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
152

Tek bir kare kontrol kutusu oluşturur. Kontrol kutusu başta boştur
Public CheckBox(String s, CheckBoxGroup c,boolean durum)

m
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

o
CheckBox kullanımını anlamak amacıyla CheckBoxTesti.java programına göz atalım :

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

i.c
import java.awt.event.*;

public class CheckBoxTesti extends Applet implements ItemListener


{
private TextField T;
private Checkbox Kalin,Italic;

public void init()

dil
{
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");
va
Italic.addItemListener(this);
add(Italic);
}

public void itemStateChanged(ItemEvent e)


{
int KalinAyari;
if(Kalin.getState())
ja

{KalinAyari=Font.BOLD;}
else
{KalinAyari=Font.PLAIN;}
int ItalicAyari;

if(Italic.getState())
w.

{ItalicAyari=Font.ITALIC;}
else
{ItalicAyari=Font.PLAIN;}
T.setFont(new Font("Serif",KalinAyari+ItalicAyari,14));
}

}
ww

Şekil 7.7.1 CheckBoxTesti.java programı

152
153

o m
i.c
Şekil 7.7.2 CheckBoxTesti.java programının sonuçlarının appletde görülmesi

Şimdi de checkBoxGroup programının çalışmasını ornekleyen RadioButtonTesti programına


göz atalım.

import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
dil
public class RadiobuttonTesti extends Applet implements ItemListener
{
private TextField T;
va
private Font NormalFont,KalinFont,ItalicFont,KalinItalicFont;
private Checkbox Normal,Kalin,Italic,KalinItalic;
private CheckboxGroup fontGurubu;

public void init()


{
setBackground(Color.lightGray);
//bos textField
ja

T=new TextField("Buradaki yazinin degismesini izleyiniz");


add(T);
fontGurubu=new CheckboxGroup();
Normal=new Checkbox("Normal",fontGurubu,true);
Normal.addItemListener(this);
add(Normal);
w.

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);
ww

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)
{

153
154

int KalinAyari;
if(e.getSource()== Normal)

m
{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);}

o
}
}

i.c
dil
va
Şekil 7.7.3 RadioButtonTetsi.java programı ve sonuçlarının applette gösterilmesi

7.8 Mouse(Fare) kontrolu

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
ja

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)
w.

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.
ww

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.

154
155

Bu metotların kullanımlarını göstermek amacıyla FareTesti.java programı aşağıda verilmiştir.

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

o
public class FareTesti extends Applet
implements MouseListener, MouseMotionListener
{
private int nx,ny=-10;
private String s="";

i.c
public void init()
{
addMouseListener(this);
addMouseMotionListener(this);
}

public void paint(Graphics g)


{

dil
g.drawString(s+"["+nx+","+ny+"]",nx,ny);
}

public void degerleriGir(String e,int x,int y)


{
s=e;
nx=x;
va
ny=y;
repaint();
}

//fare dinleyicisinin dinledikleriyle ilgili cikti metodlari


public void mouseClicked(MouseEvent e)
{ degerleriGir("Kliklendi",e.getX(),e.getY()); }
public void mousePressed(MouseEvent e)
ja

{ 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)
w.

{ 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()); }

}
ww

155
156

7.9 List sınıfı, listeden seçim

m
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.

import java.applet.Applet;

o
import java.awt.*;
import java.awt.event.*;

public class ListTesti extends Applet


implements ActionListener,ItemListener

i.c
{
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};

dil
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
va
for(int i=0;i<renkIsmi.length;i++)
{
renkListesi.add(renkIsmi[i]);
}
add(renkListesi);
}

public void actionPerformed(ActionEvent e)


{
ja

setBackground(C[renkListesi.getSelectedIndex()]);
repaint();
}

public void itemStateChanged(ItemEvent e)


{
w.

showStatus(renkListesi.getSelectedItem()+"; indeks : "+


renkListesi.getSelectedIndex());
}

}
ww

156
157

m
Ş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ı

Flow layout sınını appletde tyer alan GUI lerin sag dol ve ortada formatlanmasını saglar.
Kurucu metodu şu şekillerde tanımlanır :

o
public Flowlayout()
public Flowlayout(int formatbolgesi)
formatbolgesi FlowLayout.RIGHT, FlowLayout.CENTER veya FlowLayout.LEFT

i.c
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.

Küçuk bir örnek problemle FlowLayout kullanımını daha açık hale getirebiliriz.

import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
dil
public class FlowLayoutTesti extends Applet implements ActionListener
{
private Button B[];
va
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++)
{
ja

B[i].addActionListener(this);
add(B[i]);
}
}
public void actionPerformed(ActionEvent e)
{
w.

int pozisyon=FlowLayout.LEFT;;
if(e.getSource()==B[0])
{
pozisyon=FlowLayout.LEFT;
}
else if(e.getSource()==B[1])
{
pozisyon=FlowLayout.CENTER;
ww

}
else if(e.getSource()==B[2])
{
pozisyon=FlowLayout.RIGHT;
}
setLayout(new FlowLayout(pozisyon));
validate();
}
}

157
158

o m
i.c
dil
Ş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ı


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 :
va
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.

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

import java.awt.event.*;

public class BorderLayoutTesti extends Applet implements ActionListener


{
private Button B[];
private String S[]={"Kuzeyi Gizle","Guneyi Gizle","Doguyu Gizle",
w.

"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]);
ww

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);
}

158
159

public void actionPerformed(ActionEvent e)


{

m
for(int i=0;i<B.length;i++)
{
if(e.getSource()==B[i])
B[i].setVisible(false);
else B[i].setVisible(true);
}
validate();

o
}
}

Şekil 7.11.1 BorderLayoutTesti.java programı

i.c
dil
ja va
w.
ww

159
160

o m
i.c
Ş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ı

dil
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.
va
Şimdi bir örnekle sınıfı açıklamaya çalışalım.

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

public class GridLayoutTesti extends Applet


{
ja

private Button B[];


private String S[]={"1","1","3",
"4","5","6"};
public void init()
{
setLayout(new GridLayout(3,2,5,5));
w.

B=new Button[6];
for(int i=0;i<B.length;i++)
{
B[i]=new Button(S[i]);
add(B[i]);
}
}
}
ww

160
161

Şekil 7.12.1 BorderLayoutTesti.java programı ve sonuçlarının applette görulmesi

m
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.

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

i.c
public class Paneltesti extends Applet
{
private Panel buttonPanel;
private Button buttons[];
public void init()
{
buttonPanel=new Panel();
buttons=new Button[5];

dil
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);
}
va
}
ja

Şekil 7.13.1 PanelTesti.java programı ve sonuçlarının applette görulmesi


w.

Ş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 :

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

import java.awt.event.*;

public class PolinomunKokleri extends Applet implements ActionListener


{
// polinom a*x^2+b*x+c=0
private Panel YaziPaneli;
Label prompt1;
Label prompt2;

161
162

Label prompta;
TextField inputa; //

m
Label promptb; //
TextField inputb; //
Label promptc; //
TextField inputc; //
double a,b,c; //polinomun katsayilari
double delta=0.0; //determinant
double x1,x2; //kokler

o
public void init()
{

i.c
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);

dil
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);
va
YaziPaneli.add(prompta);
YaziPaneli.add(inputa);
YaziPaneli.add(promptb);
YaziPaneli.add(inputb);
YaziPaneli.add(promptc);
YaziPaneli.add(inputc);
add(YaziPaneli);
}
ja

public void paint(Graphics g)


{
g.setColor(Color.blue);
g.setFont(new Font("Serif",Font.BOLD,14));
w.

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(-
ww

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)
{

162
163

x1=-b/2.0/a+Math.sqrt(delta)/20/a;
x2=-b/2.0/a-Math.sqrt(delta)/2.0/a;

m
g.drawString("Kok 1 :"+x1,100,190 );
g.drawString("Kok 2 :"+x2,100,205);
}
}

public void actionPerformed( ActionEvent e)


{

o
Double sayi1=new Double(inputa.getText() );
Double sayi2=new Double(inputb.getText() );
Double sayi3=new Double(inputc.getText() );
a=sayi1.doubleValue();

i.c
b=sayi2.doubleValue();
c=sayi3.doubleValue();
delta=b*b-4.0*a*c;
repaint();
}
}

dil
ja va

Şekil 7.13.2 İkinci dereceden denklemin koklerini hesaplayan PolinomunKokleri.java


programı ve sonuçlarının applette görulmesi
w.

JAVA PROGRAMLAMA DİLİ


HAFTA 11

Bu haftaki incelenecek programlar :

LABELT~1 JAV 428 22/06/98 23:49 LabelTesti.java


ww

BAYAGI~1 JAV 7.866 22/06/98 23:21 bayagikesir.java


BUTTON~1 JAV 807 23/06/98 0:31 ButtonTesti.java
TEXTFI~1 JAV 686 23/06/98 0:45 TextFieldTesti.java
CHECKB~1 JAV 847 23/06/98 1:32 CheckBoxTesti.java
FARETE~1 JAV 1.258 23/06/98 2:08 FareTesti.java

Bu haftaki Alıştırmalar

ALISTIRMA 1

163
164

FareTesti.java programını ve gecen hafta incelediğimiz cizgiciz programını birleştirerek

m
fareyi kallanarak ekrana cizgi çizdiriniz (cizginin baslangic ve bitis noktaları fare tarafindan
belirlenecektir)

ALISTIRMA 2

o
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)

i.c
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 527


dil
30/06/98 6:52 Paneltesti.java
va
RADIOB~1 JAV 1.473 25/06/98 17:57 RadiobuttonTesti.java

ALIŞTIRMA 1

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.
ja

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

public class Panel10 extends Applet implements ActionListener


{
w.

private Panel buttonPanel;


private Button buttons[];
String s[]=
{"Birinci Butona Basildi",
"Ikinci Butona Basildi",
"Ucüncü Butona Basildi",
"Dordüncü Butona Basildi",
ww

"Besinci Butona Basildi",


"Altinci Butona Basildi",
"Yedinci Butona Basildi",
"Sekizinci Butona Basildi",
"Dokuzunccu Butona Basildi",
"Onuncu Butona Basildi"};
TextField T;
public void init()
{

164
165

T=new TextField(s[0]);

m
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);

o
buttonPanel.add(buttons[i]);
}
setLayout(new BorderLayout());
add(buttonPanel,BorderLayout.SOUTH);

i.c
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();

dil
}

}
ja va

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
w.

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
}
ww

catch( herhangibirtürException e1)


{ exception kontrol deyimleri }
catch( diğerherhangibirtürException e1)
{ exception kontrol deyimleri }
finally
{
deyimler

165
166

java kaynağını serbest bırakma deyimleri


}

m
Javadaki Exception türleri aşağıdaki listede verilmiştir :

Java.lang hata listesi

o
AbstractMethodError
ClassCircularityError
ClassFormatError
Error

i.c
ExceptionInInitializerError
IllegalAccessError
IncompatibleClassChangeError
InstantiationError
InternalError
LinkageError
NoClassDefFoundError
NoSuchFieldError
NoSuchMethodError
OutOfMemoryError
StackOverflowError
ThreadDeath
UnknownError
UnsatisfiedLinkError
dil
va
VerifyError
VirtualMachineError
Java.lang Exception listesi
ArithmeticException
ArrayIndexOutOfBoundsException
ArrayStoreException
ja

ClassCastException
ClassNotFoundException
CloneNotSupportedException
Exception
IllegalAccessException
w.

IllegalArgumentException
IllegalMonitorStateException
IllegalStateException
IllegalThreadStateException
IndexOutOfBoundsException
InstantiationException
InterruptedException
ww

NegativeArraySizeException
NoSuchFieldException
NoSuchMethodException
NullPointerException
NumberFormatException
RuntimeException
SecurityException

166
167

StringIndexOutOfBoundsException

m
Java.util exception listesi

EmptyStackException
MissingResourceException
NoSuchElementException

o
TooManyListenersException

Java.io exception listesi

i.c
CharConversionException
EOFException
FileNotFoundException
IOException
InterruptedIOException
InvalidClassException
InvalidObjectException
NotActiveException
NotSerializableException
ObjectStreamException
OptionalDataException
StreamCorruptedException
SyncFailedException
dil
va
UTFDataFormatException
UnsupportedEncodingException
WriteAbortedException
Şekil 8.1 Java hata ve exception listesi

Java hata oluştuğununda hatanın oluştuğu metodun girişinde kullanılan throws kelimesini
ja

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.
w.

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
ww

olarak verilmiştir.

public class sifiraBolunmeException


extends ArithmeticException
{
public sifiraBolunmeException()
{
super("sifira bolmeye calistiniz ");
}

167
168

m
Şekil 8.2 Bizim tarafımızdan oluşturulan sifiraBolunmeException.java hata kontrolü
programı

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

o
import java.text.DecimalFormat;
import sifiraBolunmeException;

public class sifirebolmetesti extends Applet implements ActionListener

i.c
{
private Label L1,L2;
private TextField T1,T2;
private int sayi1,sayi2;
private double sonuc;

public void init()


{

dil
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);
va
add(L2);
add(T2);
}

public double bol(int s1,int s2) throws sifiraBolunmeException


{
if(s2==0) throw new sifiraBolunmeException();
ja

return (double) s1/s2;


}

public void actionPerformed(ActionEvent e)


{
w.

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));
ww

}
catch(NumberFormatException nfe)
{showStatus("iki tam sayi girmelisiniz.");}
catch(sifiraBolunmeException sbh)
{showStatus(sbh.toString());}
}
}

168
169

o m
i.c
dil
Ş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
va
public double bol(int s1,int s2) throws sifiraBolunmeException
{
if(s2==0) throw new sifiraBolunmeException();
return (double) s1/s2;
}
ja

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)


w.

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));
ww

}
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

169
170

catch(sifiraBolunmeException sbh) deyimi tarafından yakalanmiş ve

m
showStatus("iki tam sayi girmelisiniz."); işlemini çağırmıştı bu işlem
sonunda applet sifiraBolunmeException sınıfının toString metodunu
kullanarak
sifiraBolunmeException:sıfıra bolmeye calıstınız
mesajını vermiştir.

o
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

i.c
tarafından gönderilmektedir.

dil
ja va
w.
ww

170
171

10. PARELEL KULLANIM (MULTITHREADING)

m
İş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

o
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

i.c
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.

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

dil
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
va
çalışma işlemini java dilinde doğrudan programlayabiliriz.

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.
ja

import java.awt.Graphics;import java.awt.Font;import java.util.*;import


java.applet.Applet;import java.text.*;
class saatThread extends Thread
{
Applet a;
w.

public saatThread(Applet ai)


{a=ai;}
public void run()
{
while(true)
{
a.repaint();
ww

try {Thread.sleep(1000);}
catch(InterruptedException e)
{System.err.println(e.toString());}
}
}
}

public class saat extends Applet


{
Font F;

171
172

Date D;
DateFormat df;

m
Locale tr;
saatThread r;

public void init()


{
F=new Font("TimesRoman",Font.BOLD,24);
tr=new Locale("tr","TR");

o
D=new Date();
df= DateFormat.getDateInstance(DateFormat.LONG,tr);
r=new saatThread(this);
r.start();

i.c
}

public void paint(Graphics g)


{
df.format(D);
D=new Date();
g.setFont(F);
try

dil
{
g.drawString(D.toString(),10,50);
}
catch(NullPointerException e){}
}
}
Şekil 9.1 Saat.java sınıfının thread sınıfından türemiş olarak yazılımı.
va
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);
ja

Date theDate;
Thread runner;

public void start()


{
if(runner==null)
w.

{
runner=new Thread(this);
runner.start();
}
}

public void stop()


{
ww

if(runner!=null)
{
runner.stop();
runner=null;
}
}

public void run()


{

172
173

while(true)

m
{
theDate=new Date();
repaint();
try {Thread.sleep(1000);}
catch(InterruptedException e) {}
}
}

o
public void paint(Graphics g)
{

i.c
g.setFont(theFont);
try
{
g.drawString(theDate.toString(),10,50);
}
catch(NullPointerException e){}
}
}

dil
va
Şekil 9.1 Saat.java sınıfının Runnable interface’i ile yazılımı ve applet çıktısı
ja

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.
w.

İ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.
ww

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();
}
}

class UretInteger extends Thread


{

173
174

private TutInteger pTut;

m
public UretInteger(TutInteger h)
{
pTut=h;
}

public void run()


{

o
for(int count=0; count<10; count++)
{
pTut.setOrtakInt(count);
System.out.println("OrtakInteger "+count+" degerini uretti");

i.c
try{
sleep( (int) (Math.random()*5000 ) );
}
catch(InterruptedException e)
{
System.err.println("Exeption "+e.toString());
}

dil
}
}
}

class KullanInteger extends Thread


{
private TutInteger cTut;

public KullanInteger(TutInteger h)
va
{
cTut=h;
}

public void run()


{
int Intdegeri=0;
ja

while (Intdegeri !=9)


{
try{
sleep( (int) (Math.random()*5000));
}
w.

catch(InterruptedException e)
{
System.err.println("Exeption "+e.toString());

}
Intdegeri=cTut.getOrtakInt(); System.out.println("Kullan
Integer"+Intdegeri+" degerini okudu"); } }}
class TutInteger{ private int OrtakInt; public void setOrtakInt(int
ww

Intdegeri)
{
OrtakInt=Intdegeri;
}

public int getOrtakInt()


{
return OrtakInt;
}

174
175

m
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

o
Kullan Integer5 degerini okudu
Kullan Integer5 degerini okudu
OrtakInteger 6 degerini uretti
OrtakInteger 7 degerini uretti
Kullan Integer7 degerini okudu

i.c
OrtakInteger 8 degerini uretti
OrtakInteger 9 degerini uretti
Kullan Integer9 degerini okudu
Şekil 9.2 OrtakHucre.java programı ve çıktısı

dil
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++) {
va
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());
ja

}
}
}
}
class KullanInteger implements Runnable{
private TutInteger cTut;
w.

private Thread thread;


public KullanInteger(TutInteger h) {
cTut = h;
thread= new Thread(this);
thread.start();
}
public void run() {
int Intdegeri=0;
ww

while(Intdegeri != 9) {
try {
thread.sleep((int)(Math.random()*3000));
}
catch(InterruptedException e) {
System.err.println("Exception " + e.toString());
}
Intdegeri = cTut.getOrtakInt();

175
176

System.out.println("Kullan Integer " + Intdegeri+"degerini


yakaladi");

m
}
}
}
class TutInteger {
private int OrtakInt;
public void setOrtakInt(int Intdegeri) {OrtakInt = Intdegeri;}
public int getOrtakInt() { return OrtakInt;}

o
}

public class OrtakHucreR {


public static void main(String[] args) {

i.c
TutInteger h= new TutInteger();
new UretInteger(h);
new KullanInteger(h);
}
}
Şekil 9.3 Runnable interface’i ile çalişan OrtakHucreR.java sınıfı

private TextArea cikti;


public void init()
{
dil
import java.awt.*;import java.applet.Applet;import
java.text.DecimalFormat;public class OrtakHucreBuf extends Applet{
va
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);
ja

p.start();
c.start();
}
}

class Uretinteger extends Thread


w.

{
private Tutinteger pTut;
private TextArea cikti;

public Uretinteger(Tutinteger h)
{
pTut=h;
ww

public void run()


{
for(int count=0; count<10; count++)
{
pTut.setOrtakint(count);

try{
sleep( (int) (Math.random()*500 ) );

176
177

}
catch(InterruptedException e)

m
{
System.err.println("Hata : "+e.toString());
}
}
}
}

o
class Consumeinteger extends Thread
{
private Tutinteger cTut;

i.c
public Consumeinteger(Tutinteger h)
{
cTut=h;
}

public void run()


{
int intdegeri;

while (intdegeri !=9)


{
try{

}
dil
intdegeri=cTut.getOrtakint();

sleep( (int) (Math.random()*500));

catch(InterruptedException e)
va
{
System.err.println("Hata "+e.toString());
}
intdegeri=cTut.getOrtakint();

}
}
}
ja

class Tutinteger
{
private int Ortakint[] = {9,9,9,9,9};
private boolean writeable = true;
private boolean okunabilir = false;
private int YerelOku =0, YerelYaz=0;
w.

private TextArea cikti;

public Tutinteger(TextArea out)


{
cikti = out;
}

public synchronized void setOrtakint(int intdegeri)


ww

{
while (!writeable)
{
try{

cikti.append(" Beklemede "+intdegeri);


wait();
}
catch (InterruptedException e)

177
178

{
System.err.println("Hata :"+e.toString() );

m
}
}

Ortakint[YerelYaz]=intdegeri;
okunabilir = true;
cikti.append("\n Uretilen "+intdegeri+" Yazilan "+YerelYaz);
YerelYaz = ++YerelYaz % 5;

o
cikti.append("\t yazilan hucre "+YerelYaz+"\t okunan hucre
"+YerelOku);

i.c
printBuffer(cikti, Ortakint);

if(YerelYaz==YerelOku)
{
writeable=false;
cikti.append("\nDEPOLAMA YERLER˜ DOLU ");
}
notify();

dil
}

public synchronized int getOrtakint()


{
int intdegeri;
while (!okunabilir)
{
try{
cikti.append(" KULLANMAK iCiN BEKLiYOR ");
va
wait();
}
catch (InterruptedException e)
{
System.err.println("hata:"+e.toString() );
}
}
ja

writeable=true;
intdegeri=Ortakint[YerelOku];

cikti.append("\n Kullanilan "+intdegeri+" Okundugu Hucre


"+YerelOku);
YerelOku = ++YerelOku % 5;
w.

cikti.append("\t yazilan h cre "+YerelYaz+"\t okunan hucre


"+YerelOku);

printBuffer(cikti, Ortakint);
if (YerelOku==YerelYaz)
{okunabilir=false;
cikti.append("\niNTEGER DEPOSU BOS");
}
ww

notify();

return intdegeri;
}

public void printBuffer(TextArea out,int buf[])


{

178
179

out.append("\t depo: ");


for(int i=0; i<buf.length; i++)

m
out.append(" "+buf[i]);
}
}

o
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 9 9 9
INTEGER DEPOSU BOS

i.c
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 9 9 9
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 2 3 9
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 2 3 4

dil
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 7 3 4
Kullanilan 5 Okundugu Hucre 0 yazilan hucre 3 okunan hucre 1 depo: 5 6 7 3 4
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 7 8 4
Uretilen 9 Yazilan 4 yazilan hucre 0 okunan hucre 2 depo: 5 6 7 8 9
va
Kullanilan 7 Okundugu Hucre 2 yazilan hucre 0 okunan hucre 3 depo: 5 6 7 8 9
Kullanilan 8 Okundugu Hucre 3 yazilan hucre 0 okunan hucre 4 depo: 5 6 7 8 9
Kullanilan 9 Okundugu Hucre 4 yazilan hucre 0 okunan hucre 0 depo: 5 6 7 8 9
INTEGER DEPOSU BOS

Şekil 9.4 Buffer ile uyum sağlanmış OrtakHucreBuf.java sınıfı ve applet çıktısı
ja

class OrtakHucreSyn{ public static void main(String args[]) {


TutInteger h=new TutInteger(); UretInteger p=new UretInteger(h);
KullanInteger c= new KullanInteger(h);

p.start();
w.

c.start();
}
}

class UretInteger extends Thread


{
private TutInteger pTut;
ww

public UretInteger(TutInteger h)
{
pTut=h;
}

public void run()


{
for(int count=0; count<10; count++)
{
pTut.setOrtakInt(count);

179
180

System.out.println("UretInteger OrtakInteger
degerini"+count+"olarak olusturdu");

m
try{
sleep( (int) (Math.random()*3000 ) );
}
catch(InterruptedException e)
{
System.err.println("Exeption "+e.toString());

o
}
}
}
}

i.c
class KullanInteger extends Thread
{
private TutInteger cTut;

public KullanInteger(TutInteger h)
{
cTut=h;

dil
}

public void run()


{
int Intedegeri=0;

while (Intedegeri !=9)


{
try{
va
sleep( (int) (Math.random()*3000));
}
catch(InterruptedException e)
{
System.err.println("Exeption "+e.toString());
}
Intedegeri=cTut.getOrtakInt();
System.out.println("KullanInteger "+Intedegeri+" yakalad ");
ja

}
}
}

class TutInteger
{
w.

private int OrtakInt;


private boolean Yazilabilir = true;

public synchronized void setOrtakInt(int Intedegeri)


{
while (!Yazilabilir)
{
ww

try{
wait();
}
catch (InterruptedException e)
{
System.err.println("Exception:"+e.toString() );
}
}

180
181

OrtakInt=Intedegeri;
Yazilabilir=false;

m
notify();

public synchronized int getOrtakInt()


{
while (Yazilabilir)

o
{
try{
wait();
}

i.c
catch (InterruptedException e)
{
System.err.println("Exception:"+e.toString() );
}
}

Yazilabilir=true;

dil
notify();

return OrtakInt;
}
}

UretInteger OrtakInteger degerini 0 olarak olusturduKullanInteger 0


yakaladıUretInteger OrtakInteger degerini 1 olarak olusturduKullanInteger 1
va
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
ja

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ı
w.

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


ww

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
182

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.

o m
i.c
dil
ja va
w.
ww

182
183

m
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 :

o
BufferedInputStream
BufferedOutputStream
BufferedReader
BufferedWriter

i.c
ByteArrayInputStream
ByteArrayOutputStream
CharArrayReader
CharArrayWriter
DataInputStream
DataOutputStream
File
FileDescriptor
FileInputStream
FileOutputStream
FileReader
FileWriter
FilterInputStream
FilterOutputStream
FilterReader
FilterWriter
dil
va
InputStream
InputStreamReader
LineNumberInputStream
LineNumberReader
ObjectInputStream
ObjectOutputStream
ObjectStreamClass
OutputStream
ja

OutputStreamWriter
PipedInputStream
PipedOutputStream
PipedReader
PipedWriter
PrintStream
w.

PrintWriter
PushbackInputStream
PushbackReader
RandomAccessFile
Reader
SequenceInputStream
StreamTokenizer
StringBufferInputStream
ww

StringReader
StringWriter
Writer

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.

183
184

m
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 :

File(String dosya_ismi);

o
File(String dizin_ismi, String dosya_ismi);
File(File file_tipi_nesne,String dosya_ismi);

Örnek olarak
File f1=new File(“/”);

i.c
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.

canRead()
Tanımlanan dosyadan bilgi okunulabilirliğini test eder.
canWrite()

delete()
Dosyayı siler
equals(Object)
dil
Tanımlanan dosyaya bilgi yazılabilirliğini test eder.

Dosya ismini Object te verilen dosya ismiyle karşılaştırır.


exists()
Dosyanın mevcut olup olmadığını kontrol eder.
getAbsolutePath()
va
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()
ja

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.
w.

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.
ww

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.

184
185

Bu metotları ufak bir program içinde kullanalım.

m
import java.io.*;

class FileTesti
{
public static void main(String args[])
{
File f1=new File("Hosgeldiniz.java");

o
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());

i.c
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");

dil
}
}
Şekil 10.1.1 FileTesti.java programı

Dosya ismi : Hosgeldiniz.java


Dizin ismi : Hosgeldiniz.java
Mutlak Dizin ismi : D:\co\java\prog\Hosgeldiniz.java
Ust Dizin ismi : null
va
Mevcut
Yazilabilir
Okunabilir
Dizin degil
Dosya
Mutlak dizin ismi degil
Son Degisiklik : 900410464000
Dosya boyutu : 337 Byte
ja

Ş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ş
w.

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
ww

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
186

sonra aşağıdaki deyimlerden birini kullanarak. Dosyaya bilgi aktarımı yapabiliriz.

m
import java.io.*;
import java.awt.*;
import java.awt.event.*;

public class ardisikDosyaYarat extends Frame implements ActionListener


{

o
private TextField hesapIsmiKutusu,isimKutusu,soyIsimKutusu,hesapKutusu;
private Button enter,done;
private DataOutputStream cikti;
private Label H,I,S,P;
public ardisikDosyaYarat()

i.c
{
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);
}

dil
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);
va
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);
ja

add(hesapKutusu);
enter=new Button("Gir");
enter.addActionListener(this);
add(enter);
done=new Button("Cikis");
done.addActionListener(this);
w.

add(done);
setVisible(true);
}

public void hesapEkle()


{
int accountNumber=0;
ww

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());

186
187

d=new Double(hesapKutusu.getText());
cikti.writeDouble(d.doubleValue());

m
}
hesapIsmiKutusu.setText("");
isimKutusu.setText("");
soyIsimKutusu.setText("");
hesapKutusu.setText("");
}

o
catch(NumberFormatException nfe)
{
System.err.println("Hesap numarasi tamsayi degisken olamalidir");
}
catch(IOException io)

i.c
{
System.err.println("Dosyaya yazarken hata olustu\n"+io.toString());
System.exit(1);
}
}
}
public void actionPerformed(ActionEvent e)
{

dil
hesapEkle();
if(e.getSource()==done)
{
try{ cikti.close();}
catch(IOException io)
{
System.err.println("Dosya kapatilamadi\n"+io.toString());
}
System.exit(0);
va
}
}

public static void main(String args[])


{
new ardisikDosyaYarat();
}
}
ja
w.
ww

Ş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;

187
188

private Button next,done;


private DataInputStream input;

m
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());

o
System.exit(1);
}
setSize(300,150);
setLayout(new GridLayout(5,2));

i.c
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);

dil
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);
va
add(done);
setVisible(true);
}
public void readRecord()
{
int account;
String first,last;
double balance;
ja

{
try{
account=input.readInt();
first=input.readUTF();
last=input.readUTF();
balance=input.readDouble();
w.

accountField.setText(String.valueOf(account));
firstNameField.setText(first);
lastNameField.setText(last);
balanceField.setText(String.valueOf(balance));
}
catch(EOFException eof)
{
closeFile();
ww

}
catch(IOException io)
{
System.err.println("Dosyay okurken hata olustu\n"+io.toString());
System.exit(1);
}
}
}
public void actionPerformed(ActionEvent e)

188
189

{
if(e.getSource()==next)

m
readRecord();
else
closeFile();
}

private void closeFile()

o
{
try{
input.close();
System.exit(0);
}

i.c
catch(IOException e)
{
System.err.println("Dosya Kapama Hatası oluştu\n"+e.toString());
System.exit(1);
}
}

public static void main(String args[])

dil
{
new ardisikDosyaOku();
}
}
ja va

Ş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ı


w.

try{
cikti=new DataOutputStream(new FileOutputStream("musteri.dat"));
}
catch(IOException e)
{
System.err.println("Dosya dogru acilamadi\n"+e.toString());
System.exit(1);
ww

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));

189
190

}
catch(IOException e)

m
{ System.err.println("Dosya dogru acilamadi\n"+e.toString());
System.exit(1);
}

şeklinde de yaratabilirdik. İkinci şekilde dosyayı tanımlarken tam dizin ismini de otomatik
olarak tanımlamış olurduk.

o
Dosyanın okunması içinse

try{

i.c
input=new DataInputStream(new FileInputStream("musteri.dat"));
}
catch(IOException e)
{
System.err.println("Dosya acilamadi\n"+e.toString());
System.exit(1);
}

dil
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[] )
va
byte tipi boyutludeğişkeni açılmış olan DataOutputStream kanalına yazar.

write(byte B[], int baslangıcindeksi, int indeksboyutu)

byte tipi boyutludeğişkeni açılmış olan DataOutputStream kanalına yazar.


Baslangiç indeksinden baslar ve indeksboyutu uzunluğundaki kısmı yazar.
ja

write(int B)

int datayı data output stream’e yazar.


w.

writeBoolean(boolean B)

Boolean değişkeni DataOutputStream’e yazar.

writeByte(int)
ww

int değişkeni byte olarak DataOutputStream’e yazar.

writeBytes(String)

String değişkeni byte boyutlu değişken olarak DataOutputStream’e yazar.

writeChar(int)

190
191

int değişkeni char değişken olarak DataOutputStream’e yazar.

m
writeChars(String)

String değişkeni Char değişken olarak DataOutputStream’e yazar.

o
writeDouble(double)

double değişkeni double değişken olarak DataOutputStream’e yazar.

i.c
writeFloat(float)

float değişkeni float değişken olarak DataOutputStream’e yazar.

writeInt(int)

float değişkeni float değişken olarak DataOutputStream’e yazar.

writeLong(long)

dil
long değişkeni long değişken olarak DataOutputStream’e yazar.

writeShort(int)
va
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.


ja

Metotlarından birini kullanabiliriz.

Dosyadan okumak için :


w.

read(byte[])
read(byte[], int, int)
readBoolean()
readByte()
8-bit byte integer okur
readChar()
unicode karecter(char)okur
ww

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.

191
192

readFully(byte[], int, int)

m
readInt()
İnteger okur
readLine()
Bir satırı satırbaşı yap komutuna kadar okur. Java 1.0 komutudur. 1.1 de kullanılmaması
tavsiye edilir.

o
readLong()
Long tamsayı değişkeni okur.
readShort()
Short tamsayı değişkeni okur

i.c
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)

n byte değeri okumadan atlar.


dil
Unicode Karakterini (Character) DataInput girdi akışından okur.
skipBytes(int n)

Dosya ile işlemler bittikten sonra dosya kapanır.

private void closeFile()


va
{
try{
input.close();
System.exit(0);
}
catch(IOException e)
{
System.err.println("Dosya Kapama Hatası oluştu\n"+e.toString());
ja

System.exit(1);
}
}
w.

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
ww

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 :

192
193

try{
girdi=new RandomAccessFile("musteri1.dat","rw");

m
} catch(IOException e)
{
System.err.println("Dosya acma hatasi\n"+e.toString());
System.exit(1);
}

o
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 :

i.c
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)
{
dil
System.err.println("Error closing filr\n"+e.toString());
va
System.exit(1);
}
}

metodu verilebilir.

getFD()
ja

dosya (File) tanımını verir

getFilePointer()
Dosyanın (File) o anda hangi dosya referansını gösterdiğini belirtir.
w.

length()
Dosyadaki toplam referans sayısını verir.

read()
Byte (char değişkeni karşılığı) olarak dosyadan bilgiyi okur (bir byte).

read(byte[])
ww

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.

193
194

readBoolean()

m
boolean değişken okur

readByte()

dosyadan integer tipi byte değişken (işaretli 8-bit ) okur.

o
readChar()

Dosyadan Unicode karekter (character) okur.

i.c
readDouble()

Dosyadan double değişkeni okur.

readFloat()

Dosyadan float değişkeni okur.

readFully(byte[] b)
dil
b.length bouyutundaki byte değerini boyutlu byte değişkenine aktarır.

readFully(byte[] b, int baslangıç_indisi, int toplam_boy)


va
readInt()

Dosyadan int değişkeni okur.

readLine()
ja

Dosyadan “\n” = yeni satır işaretini görene kadar yazılan her şeyi bütün bir satır olarak okur.

readLong()
w.

Dosyadan Long (Long integer) değişkeni okur.

readShort()

Dosyadan Short (Short integer) değişkeni okur.

readUnsignedByte()
ww

İşaretsiz 8 bitlik integer değeri okur.

readUnsignedShort()

İşaretsiz 16 bitlik Short integer değeri okur.

194
195

readUTF()

m
UTF stringi okur

seek(long)

indisi herhangi bir bilgi gurubu indisine ayarlar.

o
skipBytes(int n)

n bit input değerini okumadan atlar

i.c
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)
dil
va
writeChar(int)

writeChars(String)

writeDouble(double)
ja

writeFloat(float)

writeInt(int)
w.

writeLong(long)

writeShort(int)

writeUTF(String)

Şimdi de ornek programın listesini verelim:


ww

import java.io.*;

public class Kayit


{
private int hesap;
private String soyIsim;
private String Isim;

195
196

private double hesaptakiPara;


public void oku(RandomAccessFile dosya) throws IOException

m
{
//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);

o
char last[]=new char[15];
for(int i=0;i<first.length;i++)
{ last[i]=dosya.readChar(); }
soyIsim=new String(last);

i.c
hesaptakiPara=dosya.readDouble();
}

public void yaz(RandomAccessFile dosya) throws IOException


{
StringBuffer buf;
dosya.writeInt(hesap);
if(Isim!=null)

dil
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);
va
buf.setLength(15);
dosya.writeChars(buf.toString());
dosya.writeDouble(hesaptakiPara);
}

public void yazhesap(int a) {hesap = a;}


public int okuhesap() {return hesap;}
public void yazIsim(String f){Isim=f;}
ja

public String okuIsim() {return Isim;}


public void yazsoyIsim(String f){soyIsim=f;}
public String okusoyIsim() {return soyIsim;}
public void yazhesaptakiPara(double b) {hesaptakiPara=b;}
public double okuhesaptakiPara() {return hesaptakiPara;}
public static int boyut() {return 72;}
w.

10.4.1 Kayit.java dosyası

import java.io.*;
import java.awt.*;
import java.awt.event.*;
ww

import Kayit;

public class RaslantisalUlasimDosyasiYarat


{
private Kayit hesapDosyasi;
private RandomAccessFile girdi;
public RaslantisalUlasimDosyasiYarat()
{
hesapDosyasi = new Kayit();

196
197

try{
girdi = new RandomAccessFile("musteri1.dat","rw");

m
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);
}

o
}

public static void main(String args[])


{

i.c
RaslantisalUlasimDosyasiYarat H=
new RaslantisalUlasimDosyasiYarat();
}
}

10.4.2 RaslantisalUlasimDosyasiYarat.java dosyası

import java.io.*;
import
import
import
java.awt.*;
java.awt.event.*;
Kayit;

dil
public class RaslantisalUlasimDosyasiYaz extends Frame implements
ActionListener
{
private TextField hesapAlani,isimAlani,soyisimAlani,hesaptakiParaAlani;
va
private Button birsonraki,kapat;
private RandomAccessFile girdi;
private Kayit hesapDosyasi;
public RaslantisalUlasimDosyasiYaz()
{
super("Tesadufi ulasim dosyasina yaz");
hesapDosyasi=new Kayit();
try{
ja

girdi=new RandomAccessFile("musteri1.dat","rw");
} catch(IOException e)
{
System.err.println("Dosya acma hatasi\n"+e.toString());
System.exit(1);
}
setSize(300,150);
w.

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);
ww

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);

197
198

kapat=new Button("cikis");
kapat.addActionListener(this);

m
add(kapat);
setVisible(true);
}

public void addKayit()


{
int accountNumber=0;

o
Double d;
if(!hesapAlani.getText().equals(""))
{
try{

i.c
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());

dil
girdi.seek((long)(accountNumber-1)*Kayit.boyut());
hesapDosyasi.yaz(girdi);
}
hesapAlani.setText("");
isimAlani.setText("");
soyisimAlani.setText("");
hesaptakiParaAlani.setText("");
}
catch(NumberFormatException nfe)
va
{
System.err.println("Hesap numarasi tamsayi degisken olamalidir");
}
catch(IOException io)
{
System.err.println("Dosyaya yazarken hata olustu\n"+io.toString());
System.exit(1);
}
ja

}
}
public void actionPerformed(ActionEvent e)
{
addKayit();
if(e.getSource()==kapat)
w.

{
try{ girdi.close();}
catch(IOException io)
{
System.err.println("Dosya kapatilamadi\n"+io.toString());
}
System.exit(0);
}
ww

}
public static void main(String args[])
{
new RaslantisalUlasimDosyasiYaz();
}
}

198
199

o m
i.c
10.4.3 RaslantisalUlasimDosyasiYaz.java dosyası ve Frame çıktısı

import
import
import
import
java.io.*;
java.awt.*;
java.awt.event.*;
Kayit; dil
public class RaslantisalUlasimDosyasiOku extends Frame implements
ActionListener
va
{
private TextField hesapAlani,isimAlani,soyisimAlani,hesaptakiParaAlani;
private Button birsonraki,kapat;
private RandomAccessFile girdi;
private Kayit hesapDosyasi;
public RaslantisalUlasimDosyasiOku()
{
super("Musteri dosyasini oku");
ja

try{
girdi=new RandomAccessFile("musteri1.dat","r");
} catch(IOException e)
{ System.err.println("Dosya acilamadi\n"+e.toString());
System.exit(1);
}
w.

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);
ww

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);

199
200

add(birsonraki);
kapat=new Button("cikis");

m
kapat.addActionListener(this);
add(kapat);
setVisible(true);
}

public void okuKayit()


{

o
int hesap;
String ilk,son;
double balance;
{

i.c
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()));

dil
hesaptakiParaAlani.setText(String.valueOf(hesapDosyasi.okuhesaptakiPara()))
;
}
catch(EOFException eof)
{
closeFile();
}
catch(IOException io)
{
va
System.err.println("Dosyay okurken hata olustu\n"+io.toString());
System.exit(1);
}
}
}

public void actionPerformed(ActionEvent e)


{
ja

if(e.getSource()==birsonraki)
okuKayit();
else
closeFile();
}
w.

private void closeFile()


{
try{
girdi.close();
System.exit(0);
}
catch(IOException e)
{
ww

System.err.println("Error closing filr\n"+e.toString());


System.exit(1);
}
}

public static void main(String args[])


{
new RaslantisalUlasimDosyasiOku();
}

200
201

o m
i.c
10.4.4 RaslantisalUlasimDosyasiOku.java dosyası ve Frame çıktısı

Yukardaki proğramın ilginç bir yönü de Applet yerine Frame sınıfını kullanmış olmasıdır.

dil
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.
ja va
w.
ww

201
202

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

m
11.1 Vector Sınıfı

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.

o
Örneğin double b[]=new double[3];
Deyimi bilgisayar belleğinde

i.c
1023400 b[0]
1023464 b[1]
1023528 b[2]

yerlerini birbirini izleyen adreslerde ayırır.

değiştirmektir.

double c[]=new double[5];


for(int i=0,i<b.length;i++)
{ c[i]=b[i];}
dil
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
va
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.
ja

Dizinin arasından herhangibir elemanı da kalaylıkla sadece referans adresini değiştirerek


silebiliriz.
w.

Vector sınıfında tanımlanan metodlar

addElement(Object)

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.
ww

capacity()

vectörn toplam kapasitesini verir.

clone()

202
203

vectorun bir kopye vectörünü verir.

m
contains(Object)

Vectörün içinde sorgulanan elemanın olup olmadığını kontrol eder.

copyInto(Object[])

o
vectorü boyutlu değişkene aktarır.

elementAt(int indeks)

i.c
Verilen indeksteki elemanı verir..

elements()

Tüm vektörü enumeration sınıfına aktarır.

ensureCapacity(int yeni_kapasite)

dil
eğer yeni_kapasite vector kapasitesinin üstündeyse vector yeni_kapasite’ye aktarılır.

firstElement()

Vectörün ilk elemanını verir.


va
indexOf(Object)

Object’in indeks değerini verir

indexOf(Object, int indeks)


ja

Object’in indeks değerini verir, arama indeks değişkeninden başlayarak yapılır.

insertElementAt(Object, int indeks)


w.

Vectörün ideks noktasına Object ilave edilir.

isEmpty()

Vectörün boş olup olmadığı kontrol edilir.

lastElement()
ww

vectörün son elemanının indeksini verir.

lastIndexOf(Object)

Object’in vectördeki son tekrarının indeksini verir.

203
204

lastIndexOf(Object, int indeks)

m
indeks ten başlayarak geriye doğru Objectin ilk tekrarlandığı yeri bulur.

removeAllElements()

Vectördeki bütün elemanları siler.

o
removeElement(Object)

Vectördeki Object elemanını siler.

i.c
removeElementAt(int indeks)

indeksle verilen elemanı siler.

setElementAt(Object, int indeks)

setSize(int)

Sets the size of this vector.

size()
dil
Objectin ideksini indeks olarak belirler.
va
Vectördeki toplam eleman sayısını verir.

toString()

Vectörün String eşitini verir.


ja

trimToSize()

Vectörün boyutunu dolu olan elemanlarının boyutuna kısaltır.


w.

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,
ww

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);

204
205

prompt= new Label("Bir String degiskeni giriniz ");


input = new TextField(10);

m
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");

o
trimBtn = new Button("Kes");
statsBtn = new Button("Istatistikler");
displayBtn = new Button("Listeyi Goster");
add(prompt);

i.c
add(input);
addBtn.addActionListener(this);
YaziPaneli.add(addBtn);
removeBtn.addActionListener(this);
YaziPaneli.add(removeBtn);
firstBtn.addActionListener(this);
YaziPaneli.add(firstBtn);
lastBtn.addActionListener(this);

dil
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);
va
statsBtn.addActionListener(this);
YaziPaneli.add(statsBtn);
displayBtn.addActionListener(this);
YaziPaneli.add(displayBtn);
add(YaziPaneli);
}

public void actionPerformed(ActionEvent e)


ja

{
if(e.getSource()==addBtn)
{ v.addElement(input.getText());
showStatus("Listenin sonuna eklendi: "+input.getText()); }
else if(e.getSource()==removeBtn)
{ if(v.removeElement(input.getText()))
w.

showStatus("Silindi :"+input.getText());
else
showStatus(input.getText()+"not in vector");
}
else if(e.getSource() == firstBtn)
{
try{
showStatus("Ilk eleman : "+v.firstElement());
ww

}
catch(NoSuchElementException exception)
{
showStatus(exception.toString() );
}
}
else if(e.getSource()==lastBtn)
{ try{
showStatus("Son eleman : "+v.lastElement());

205
206

}
catch(NoSuchElementException exception)

m
{ showStatus(exception.toString() );}
}
else if(e.getSource() == emptyBtn)
{
showStatus(v.isEmpty()? "Vector bos ":"vector dolu ");
}
else if(e.getSource()==containsBtn)

o
{
String searchKey = input.getText();

if(v.contains(searchKey) )

i.c
showStatus("Vektor elemanlari " +searchKey);
else
showStatus("Aranan eleman Vektorde bulunamadi "+searchKey);
}
else if(e.getSource()==locationBtn)
{ showStatus("Eleman "+v.indexOf(input.getText() )+" pozisyonunda
bulundu");
}

dil
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());
}
va
else if(e.getSource()== displayBtn) {
Enumeration enum=v.elements();
StringBuffer buf = new StringBuffer();
while(enum.hasMoreElements())
{
buf.append(enum.nextElement() );
buf.append(" ");
}
ja

showStatus(buf.toString() );
}
input.setText("");
}
}
w.
ww

206
207

o m
i.c
Şekil 11.1.1 VectorTesti.java programı ve applet çıktısı

Bundan sonraki program iki kümenin bileşim ve kesişim kümelerini hesaplamaktadır.

dil
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.

Enumeration n1=list1.elements();
Enumeration n2=list2.elements();
while(n1.hasMoreElements())
{
va
s1=(String)n1.nextElement();
bilesimVectoru.addElement(s1);
}

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
ja

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.*;
w.

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

class SetA
{
public Vector bilesim(Vector list1, Vector list2)
ww

{
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);
}

207
208

while(n2.hasMoreElements())
{

m
s2=(String)n2.nextElement();
if(!bilesimVectoru.contains(s2))
bilesimVectoru.addElement(s2);
}
return bilesimVectoru;
}

o
public Vector kesisim(Vector list1,Vector list2)
{
Vector kesisimVectoru = new Vector();
String s;

i.c
Enumeration n = list1.elements();
while(n.hasMoreElements())
{
s=(String)n.nextElement();
if(list2.contains(s))
kesisimVectoru.addElement(s);
}
return kesisimVectoru;

dil
}
}

public class SetTest extends Applet implements ActionListener


{
SetA set = new SetA(); // SetA
Label L1, P1, P2;
TextField T1,T2;
TextArea cikti;
va
// 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
ja

Vector ansUn;
Vector ansInt;

public void init() {


P1 = new Label("Birinci listeyi gir : ");
T1 = new TextField(50);
w.

P2 = new Label("Ikinci listeyi gir : ");


T2 = new TextField(50);

//Sonuclarin yazildigi yazi alanini ac


cikti = new TextArea(10,40);
cikti.setEditable(false);
cikti.setText("");
add(P1);
ww

add(T1);
T1.addActionListener(this);
add(P2);
add(T2);
T2.addActionListener(this);
add(cikti);
}

public void girdiA(String string, Vector list)

208
209

{
// StringTokeniser sinifi String degiskenleri icin

m
// 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);
}

o
}

public void ciktiA(Vector v)


{

i.c
Enumeration enum = v.elements();
while(enum.hasMoreElements())
{
String ans = (String)enum.nextElement();
cikti.append(ans + "\n");
}
}

dil
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==T1)
{
String stringToTokenize = T1.getText();
girdiA(stringToTokenize,list1);
}
else if(e.getSource()==T2)
{
va
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);
ja

cikti.append("\nIki listenin kesisim kumesi : \n");


ciktiA(ansInt);
}
} //actionPerformed metodunun sonu
}
w.

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.
ww

209
210

o m
i.c
dil
Ş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ı
va
JAVA PROGRAMLAMA DİLİ
HAFTA 14

Hafta 13 dosyaları :

ORTAKH~1 JAV 1.787 21/07/98 6:40 OrtakHucreR.java


ja

ORTAKH~2 JAV 1.668 21/07/98 6:37 OrtakHucre.java


ORTAKH~3 JAV 3.792 21/07/98 7:06 OrtakHucreBuf.java
ORTAKH~4 JAV 2.335 21/07/98 7:09 OrtakHucreSyn.java

Bu haftaki dosyalar
w.

SAAT~1 JAV 991 28/07/98 5:47 saat.java


SETTES~3 JAV 3.730 27/07/98 17:55 SetTest.java
VECTOR~1 JAV 4.456 27/07/98 16:56 VectorTesti.java

ALISTIRMA 1
ww

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.

ALIŞTIRMA 2

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.

210
211

12 ÖRNEKLERLE SAYISAL ANALİZ

m
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.

o
İlkönce Matrix sınıfının metot başlıklarını verelim :

toString Metotları

i.c
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)

dil
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[][])
va
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)
ja

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)
w.

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)
ww

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)

211
212

Transpose matriks
public static double[][] Transpose(double [][] left)

m
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)

o
EigenValue Poblemi
public static double[][] balance(double b[][])
public static double[][] Hessenberg(double b[][])
public static double[][] QR(double b[][])

i.c
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[])

Matrix Sınıfının Listesi :

//
//
dil
//=============================================================
Numerical Analysis Packages in Java
Matrix calculations class Matrix
va
// Author : Dr. Turhan Coban
//=============================================================
//Turhan Coban
import java.io.*;
import complex;

public class Matrix


{
ja

// This class defines matrix and vector


// calculation methods

public static String toString(double left)


{
//arrange double to string conversion so that all the
w.

//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+" ";
ww

n=s.length();
}
return s;
}

public static String toString(double[][] left)


{
//return a string representation of a matrix
int n,m;

212
213

String b;
b="";

m
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]);

o
}
b=b+"\n";
}
return b;

i.c
}

public static String toString(complex[][] left)


{
//return a string representation of a complex matrix
int n,m;
String b;
b="";

dil
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";
va
}
return b;
}

public static String toStringT(complex[] left)


{
// returns a horizontal string representation of
// a complex vector
ja

int n,m;
String b;
b="";
n=left.length;
for(int i=0;i<n;i++)
{
w.

b=b+left[i].toString()+"\n";
}
return b;
}

public static String toString(complex[] left)


{
// returns a vertical string representation of
ww

// a complex vector
int n,m;
String b;
b="";
n=left.length;
for(int i=0;i<n;i++)
{
b=b+left[i].toString()+" ";
}

213
214

b=b+"\n";
return b;

m
}

public static String toStringT(double[] left)


{
// returns a vertical string representation
// of a double vector
int n,m;

o
String b;
b="";
n=left.length;
for(int i=0;i<n;i++)

i.c
{
b=b+toString(left[i])+"\n";
}
return b;
}

public static String toString(double[] left)


{

dil
// 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]);
va
}
b=b+"\n";
return b;
}
public static String toString(int[] left)
{
// returns a horizontal string representation
// of a integer vector
ja

int n,m;
String b;
b="";
n=left.length;
for(int i=0;i<n;i++)
{
w.

b=b+left[i]+"\t";
}
b=b+"\n";
return b;
}

public static double SIGN(double a,double b)


{
ww

//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);

214
215

m
public static double[][] inv(double[][] a)
{
// INVERSION OF A MATRIX
// inversion by using gaussian elimination
// with full pivoting
int n=a.length;

o
int m=a[0].length;
double b[][];
b=new double[n][n];
int indxc[];

i.c
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;

dil
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;
}
va
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++)
{
ja

if(ipiv[j] != 1)
for(k=0;k<n;k++)
{
if(ipiv[k] == 0)
{
if(Math.abs(b[j][k]) >= big)
w.

{
big=Math.abs(b[j][k]);
irow=j;
icol=k;
}
}
else if(ipiv[k] > 1 )
{
ww

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;
}
}
}

215
216

++ ipiv[icol];
if(irow != icol)

m
for(l=0;l<n;l++)
{
temp=b[irow][l];
b[irow][l]=b[icol][l];
b[icol][l]=temp;
}
indxr[i]=irow;

o
indxc[i]=icol;
if(b[icol][icol] == 0.0)
{
System.out.println("error : inverse of the matrix : singular matrix-

i.c
2");
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;

dil
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;
}
}
va
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;
ja

}
}
return b;
}

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


w.

{
//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


ww

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;

216
217

int i,j,k;
int imax;

m
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];

o
}
d[0]=1;
for(i=1;i<=n;i++)
{

i.c
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;
}

dil
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];
}
va
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++)
{
ja

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)
{
w.

imax=i;
big=dum;
}
} //end of i=0
if(j != imax)
{
for(k=1;k<=n;k++)
{
ww

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;

217
218

if(j!=n)
{

m
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;
}

o
public static double[] LUaxb(double a[][],double x[],int indx[])
{

i.c
//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];

dil
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];
va
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;
ja

b[i-1]=sum;
}
for(i=n;i>=1;i--)
{
sum=b[i-1];
if(i<n)
w.

{
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];
}
ww

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];

218
219

int d[]={1};
int indx[]=new int[n];

m
double e[][]=new double[n][n];
e=Matrix.LU(a,indx,d);
c=Matrix.LUaxb(e,b,indx);
return c;
} //end of AXB

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

o
{
//inverse of a matrix by using LU decomposition method
//this method is more efficient than inv (or inverse)
int n=a.length;

i.c
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++)
{

dil
c[i]=Matrix.LUaxb(e,b[i],indx);
}
return Matrix.T(c);
} //end of LUinv

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


{
//determinant of a matrix
int n=a.length;
va
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];
ja

return e;
} //end of det

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


{
//determinant of a matrix
w.

return Matrix.det(a);
}

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


{
//determinant of a matrix
return Matrix.det(a);
}
ww

//************* 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;

219
220

int n2=right.length;
double[][] b;

m
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++)

o
b[ii][jj]=0;
}
return b;
}

i.c
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];
}
}

dil
return b;
//end of multiply of two matrices
}

public static double[] multiply(double[][] left,double[] right)


{
//multiplication of one matrix with one vector
int ii,jj,i,j,k;
va
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");
ja

for(ii=0;ii<n1;ii++)
{
b[ii]=0;
}
return b;
}
w.

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
ww

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;

220
221

double[] b;
b=new double[m1];

m
if(n2 != m1)
{
System.out.println("inner matrix dimensions must agree");
for(ii=0;ii<n2;ii++)
{
b[ii]=0;
}

o
return b;
}
for(i=0;i<m2;i++)
{

i.c
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
}

dil
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++)
va
{
for(j=0;j<m;j++)
b[i][j]=right[i][j]*left;
}
return b;
//end of multiplying a matrix with a constant double
}
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;
w.

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;
ww

//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[];

221
222

b=new double[n];
for(i=0;i<n;i++)

m
{
b[i]=left*right[i];
}
return b;
}

public static double[] multiply(double[] left,double right)

o
{
//multiplying a vector with a constant
int i;
int n=left.length;

i.c
double b[];
b=new double[n];
for(i=0;i<n;i++)
{
b[i]=right*left[i];
}
return b;
}

dil
//*************** 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;
va
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;
ja

}
else
{
b[i][j]=Math.pow(right[i][j],left);
}
}
w.

}
return b;
//end of power of a matrix
}

public static double[] pow(double[] right,double left)


{
// power of a vector
ww

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;

222
223

}
else

m
{
b[i]=Math.pow(right[i],left);
}
}
return b;
//end of power of a vector
}

o
//=================end of power method pow definitions =============
//***************** addition add methods **************************

i.c
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;

dil
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++)
{
va
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++)
ja

{
b[i][j]=b[i][j]+right[i][j];
}
}
return b;
//end of matrix addition method
w.

public static double[] add(double[] left,double[] right)


{
//addition of two vectors
int n1=left.length;
int n2=right.length;
int nMax;
ww

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];
}

223
224

for(i=0;i<n2;i++)
{

m
b[i]=b[i]+right[i];
}
return b;
//end of vector addition method
}

public static double[][] substract(double[][] left,double[][] right)

o
{
//addition of two matrices
int n1=left.length;
int m1=left[0].length;

i.c
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;

dil
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];
}
}
va
for(i=0;i<n2;i++)
{
for(j=0;j<m2;j++)
{
b[i][j]=b[i][j]-right[i][j];
}
}
return b;
ja

//end of matrix substraction method


}

public static double[] substract(double[] left,double[] right)


{
//addition of two vectors
w.

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];
ww

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;

224
225

//end of vector substraction method


}

m
//============== 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;

o
double b[][];
b=new double[n][m];
b=Matrix.multiply(Matrix.inv(right),left);
return b;

i.c
}

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[][];

dil
b=new double[n][m];
b=Matrix.multiply(Matrix.LUinv(right),left);
return b;
}

public static double[] divide(double[] left,double[][] right)


{
//division of two matrices
va
int n=right.length;
int m=right[0].length;
double b[];
b=new double[n];
b=Matrix.multiply(Matrix.inv(right),left);
return b;
}
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);
w.

//============== absolute value of a matrix===================

public static double abs(double[][] left)


{
// absoulute value of a matrix
int i,j;
ww

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;

225
226

m
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++)

o
{
b=b+Math.abs(left[i]);
}
return b;

i.c
}

//===============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;

dil
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];
}
va
}
return b;
}

public static double[][] T(double [][] left)


{
//transpose matrix (if A=a(i,j) T(A)=a(j,i)
int i,j;
ja

int n=left.length;
int m=left[0].length;
double b[][];
b=new double[m][n];
for(i=0;i<n;i++)
{
w.

for(j=0;j<m;j++)
{
b[j][i]=left[i][j];
}
}
return b;
}
ww

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++)

226
227

{
for(j=0;j<m;j++)

m
{
b[j][i]=new complex(left[i][j]);
}
}
return b;
}

o
public static double[][] I(int n)
{
//unit matrix

i.c
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)

dil
{
//one matrix
double b[];
b=new double[n];
for(int i=0;i<n;i++)
b[i]=1.0;
return b;
}
va
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++)
ja

{
a[0][i]=-c[i+1]/c[0];
}
for(i=0;i<n-1;i++)
{
a[i+1][i]=1;
w.

}
return a;
}

//===========Eigen value calculations ==============

public static double[][] balance(double b[][])


{
ww

// 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[][];

227
228

a=new double[n][n];
f=1;

m
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;

o
for(i=1;i<=n;i++)
{
c=0;r=0;
for(j=1;j<=n;j++)

i.c
{
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 )

dil
{
g=r/radix;
f=1.0;
s=c+r;
while(c<g)
{
f*=radix;
c*=sqrdx;
}
va
g=r*radix;
while(c>g)
{
f/=radix;
c/=sqrdx;
}
} //end of if(c != 0 && ....
if( (c+r)/f < 0.95*s )
ja

{
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..
w.

}//end of for(i=1;i<=n....
} //end of while last==0
return a;
}

public static double[][] Hessenberg(double b[][])


{
// Calculates the hessenberg matrix
ww

// 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];

228
229

double x,y;
if(n>2)

m
{
for(m=2;m<=(n-1);m++)
{
x=0.0;
i=m;
for(j=m;j<=n;j++)
{

o
if(Math.abs(a[j-1][m-2]) > Math.abs(x))
{
x=a[j-1][m-2];
i=j;

i.c
} //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];

dil
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)
va
if(x != 0.0)
{
for(i=(m+1);i<=n;i++)
{
y=a[i-1][m-2];
if(y!=0.0)
{
y=y/x;
ja

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++)
w.

{
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
ww

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[][])

229
230

{
//calculates eigenvalues of a Hessenberg matrix

m
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;

o
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]);

i.c
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 {

dil
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;
va
}
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));
ja

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;
w.

}
else {
wr[nn-1]=wr[nn]=x+p;
wi[nn-1]= -(wi[nn]=z);
}
nn -= 2;
}
else {
ww

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;
}

230
231

++its;
for (m=(nn-2);m>=l;m--) {

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);

o
p /= s;
q /= s;
r /= s;
if (m == l) break;

i.c
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;

dil
}
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;
va
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];
ja

}
else
a[k][k-1] = -s*x;
p += s;
x=p/s;
y=q/s;
w.

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;
ww

}
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];

231
232

a[i][k+2] -= p*r;
}

m
a[i][k+1] -= p*q;
a[i][k] -= p;
}
}
}
}
}

o
} while (l < nn-1);
}
for(i=0;i<n;i++)
{

i.c
rm[0][i]=wr[i+1];
rm[1][i]=wi[i+1];
}
return rm;
} //end of QR

public static double[][] eigenValue(double b[][])


{

dil
// 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;
}
va
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
ja

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++)
{
w.

c[i]=new complex(d[0][i],d[1][i]);
}
return c;
}

//roots of a polynomial
public static double[][] poly_roots(double c[])
{
ww

//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;
}

232
233

public static complex[] poly_rootsC(double c[])

m
{
// 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);

o
double d[][]=new double[2][n];
d=eigenValue(a);
complex e[]=new complex[n];
for(int i=0;i<n;i++)

i.c
e[i]=new complex(d[0][i],d[1][i]);
return e;
}

public static double[][] balancedEigenValue(double b[][])


{
// this routine input a matrix (non symetric or symmetric)
// and calculates eigen values

dil
// 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;
}

public static double[][] tridiagonal(double b[][], double d[], double e[])


va
{
//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];
ja

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;
w.

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++) {
ww

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;

233
234

for (j=1;j<=l;j++) {
a[j-1][i-1]=a[i-1][j-1]/h;

m
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];

o
}
hh=f/(h+h);
for (j=1;j<=l;j++) {
f=a[i-1][j-1];

i.c
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-
1]);
}
}
} else
e[i-1]=a[i-1][l-1];

dil
d[i-1]=h;
}
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) {
va
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];
}
}
ja

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;
}
w.

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));
ww

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;

234
235

int m,l,iter,i,j,k;
double s,r,p,g,f,dd,c,b;

m
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++) {

o
iter=0;
do {
for (m=l;m<=n-1;m++) {
dd=Math.abs(d[m-1])+Math.abs(d[m]);

i.c
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));

dil
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;
va
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;
ja

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;
}
}
w.

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;
ww

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

235
236

// this method use eigenValue method (a QR algorithm)


int i,j;

m
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);

o
b=QL(d,e,b);
for(j=0;j<n;j++)
{
z[0][j]=d[j];

i.c
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;
}

//end of eigen value programs

//end of class Matrix


}

Matrix Sınıfı örnek programları


1. İnverse matris
dil
va
import java.io.*;
import Numeric;

class Matrix3
{
public static void main(String args[]) throws IOException
{
ja

/*
double a[][];
a=new double[5][5];
a[0][0]=1;
a[0][1]=2;
a[0][2]=0;
w.

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;
ww

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
237

a[4][1]=6;
a[4][2]=-70;

m
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];

o
int d[]=new int[1];
b[0]=1;
b[1]=0;
b[2]=0;

i.c
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))));

dil
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));
va
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))));
}
}
ja

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
w.

-5.0 6.0 -70.0 8.0 -9.0


Inverse Matrix : (Method inv)
0.4285714285714286 -0.2857142857142857 0.0 -1.1895246692412392E-17 3.96508223080413E-
18
0.2857142857142857 0.14285714285714285 0.0 5.947623346206196E-18-
1.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
ww

-0.003628117913832162 0.01723356009070296-0.0031746031746031824 0.12698412698412698-


0.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

Solution of system of equation :


with second side :

237
238

1.0
0.0
0.0

m
0.0
0.0
0.4285714285714286
0.2857142857142857
-0.048571428571428564
-0.37551020408163255
-0.003628117913832162
LU decomposed matrix : (Method LU)

o
-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

i.c
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.12698412698412698-
0.1111111111111111

Matrix * Inverse Matrix (LU Decomposition) :

dil
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 1.0

2. n inci dereceden polinomun kökleri

import java.io.*;
import Numeric;
va
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];
ja

/*
double e[]=new double[4];
e[0]= -1;
e[1]= 8;
e[2]=-19;
e[3]= 12;
w.

*/
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)
ww

// 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

238
239

System.out.println("eigen values (Method balancedeigenValue)");

m
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)

o
//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))));

i.c
System.out.println("roots of polynomial (Method poly_roots)");
System.out.println(Matrix.toStringT(Matrix.poly_rootsC(e)));
}
}

cözüm :

dil
Original polynomial :
-1.0 8.0 -19.0 12.0

Characteristic Matrix :
8.0 -19.0 12.0
1.0 0.0 0.0
0.0 1.0 0.0

eigen values (Method eigenValue)


va
3.9999999999999964 0.0
3.0000000000000067 0.0
0.9999999999999991 0.0

eigen values (Method balancedeigenValue)


4.000000000000007 0.0
2.999999999999993 0.0
1.0000000000000004 0.0
ja

eigen values (Method eigenValueC)


3.9999999999999964
3.0000000000000067
0.9999999999999991
w.

roots of polynomial (Method poly_roots)


3.9999999999999964 0.0
3.0000000000000067 0.0
0.9999999999999991 0.0

roots of polynomial (Method poly_roots)


3.9999999999999964
3.0000000000000067
ww

0.9999999999999991

3. Determinant

import java.io.*;
import Numeric;

239
240

class Matrix5
{

m
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;

o
a[1][0]=3;
a[1][1]=4;
System.out.println("Matrix : ");
System.out.println(Matrix.toString(a));

i.c
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));
}
}

dil
cözümü :
Matrix :
1.0 2.0
3.0 4.0

Inverse Matrix :
-2.0 1.0
1.5 -0.5
va
Matrix * Inverse Matrix :
1.0 0.0
0.0 1.0

Determinant = -2.0

4. Eigenvalue
ja

import java.io.*;
import Numeric;

class Matrix6
{
w.

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 : ");
ww

System.out.println(Matrix.toString(Matrix.eigenQL(a)));
}
}

çözümü :

Original Matrix :
3.0 -1.0 0.0
-1.0 2.0 -1.0

240
241

0.0 -1.0 3.0

m
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

o
Numeric sınıfı (Sayısal analiz paketi)

Numerik sınıfı ve fonksiyon girdi sınıfları ve metotları :

i.c
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])

dil
// 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

// birden fazla fonksiyon birden fazla değişken


// tüm fonksiyonların değerini vektör olarak verir
va
// ö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]
ja

// 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[]);
w.

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
ww

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)
Non-linear denklem kökleri
public static double newton(double x,f_x y,f_x dy)
public static double newton(double x,f_x y)
public static double newton_2nd_derivative(double x,f_x y,f_x dy)
public static double newton_2nd_derivative(double x,f_x y)
public static double secant_2nd_derivative(double x,f_x y)

241
242

public static double bisection(double xl,double xu,f_x y)


public static double[] newton( double x[],fi_xi y,fij_xi dy)

m
public static double[] newton( double x[],fi_xi y)
Least Square polinom uydurma
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[])

o
public static double[][] orthogonal_polynomial_least_square
(double xi[],double fi[],int m)
public static double f_orhogonal_polynomial(double a[][],double x)
Diferansiyel denklemler
public static double[] RK4(f_xi fp,double x0,double xn,double f0,int N)

i.c
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

Numeric sınıfı listesi :

//
//
// dil
//=============================================================
Numerical Analysis Package in Java
Numerical analysis calculation class Numeric
Author : Dr. Turhan Coban
//=============================================================
import java.io.*;
import Matrix;
va
abstract class f_x
{
//single function single independent variable
// example f=x*x
abstract double func(double x);
}
ja

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]
w.

// 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


{
ww

// 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

abstract double[] func(double x[]);


}

242
243

abstract class fij_xi

m
{
// 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]

o
// f[1][0], f[1][1]
// as a two dimensional matrix

abstract double[][] func(double x[]);

i.c
}

public class Numeric


{
//This is a library of numerical methods
//
public static double derivative(f_x f_deriv,double x)

dil
{
// 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;
va
//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++)
{
ja

h[i]=0;
for(int j=0;j<n;j++)
T[i][j]=0;
}
h[0]=h0;
double r=0.5;
w.

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]);
ww

}
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]);
}
}

243
244

double xx=T[0][n-1];
return xx;

m
}

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

o
// variables h0 and n
// function input should be in the form given in abstract class
// f_xi

i.c
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++)

dil
{
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];
va
//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;
ja

double r=0.5;
for( i=1;i<n;i++)
{
h[i]=h0*Math.pow(r,i);
}
w.

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];
ww

}
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]);
}
}

244
245

double xx=T[0][n-1];
return xx;

m
}

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

o
// variables h0 and n
// function input should be in the form given in abstract class
// f_xi
double h0=0.0256;

i.c
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];

dil
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[][];
va
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++)
ja

T[i][j]=0;
}
h[0]=h0;
double r=0.5;
for( i=1;i<n;i++)
{
w.

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);
ww

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++)
{

245
246

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]);

m
}
}
double xx=T[0][n-1];
return xx;
}

public static double integral(f_x f_xnt,double a,double b)

o
{
//integral of a function by using gauss-legendre quadrature
//
double s[],w[];

i.c
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;

dil
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;
va
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;
ja

s[22] = .84892524739665800000E+00;
s[23] = .88388871605241310000E+00;
s[24] = .91478288119138420000E+00;
s[25] = .94128026789602640000E+00;
s[26] = .96310002371463720000E+00;
s[27] = .98001093248415370000E+00;
w.

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;
ww

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;

246
247

w[15] = .51426326446779420000E-01;
w[16] = .50881194874202750000E-01;

m
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;

o
w[24] = .28746578108808720000E-01;
w[25] = .24201336415292590000E-01;
w[26] = .19399596284813530000E-01;
w[27] = .14392353941661670000E-01;

i.c
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];

dil
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;
}
va
return z;
}

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
ja

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;
}
w.

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;
ww

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++;

247
248

h/=2.0;
Numeric.trap(ff,a,h,j,m,R);

m
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];
}

o
}while(close>tol && j<n);
return ret;
}

i.c
//==================================================
//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

dil
// 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);
va
x-=fx/dfx;
if(Math.abs(fx)<tolerance)
{
return x;
}
}
return x;
}
ja

public static double newton(double x,f_x y)


{
// Newton - Raphson method for single equation
// required function only derivative is calculated
w.

// numerically by using method derivative

int nmax=500;
double tolerance=1.0e-15;
double fx,dfx;
for(int i=0;i<nmax;i++)
{
fx=y.func(x);
ww

dfx=Numeric.derivative(y,x);
x-=fx/dfx;
if(Math.abs(fx)<tolerance)
{
return x;
}
}
return x;
}

248
249

m
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;

o
double x1m;
double tolerance=1.0e-15;
double fx,fxm,dfx,dfxm,d2fx;
for(int i=0;i<nmax;i++)

i.c
{
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)

dil
{
return x;
}
}
return x;
}

public static double newton_2nd_derivative(double x,f_x y)


{
va
// 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;
ja

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);
w.

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;
}
}
ww

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;

249
250

double dx=1.0e-3;
double dx1=2.0e-3;

m
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);

o
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);

i.c
x-=(fx/dfx+.5*fx*fx/(dfx*dfx*dfx)*d2fx);
if(Math.abs(fx)<tolerance)
{
return x;
}
}
return x;
}

//function should be supplied


// defination of variables :
// xl : lower guess
// xu : upper guess
dil
public static double bisection(double xl,double xu,f_x y)

//bisection method to find roots of a function y.func(x)


va
// xr : root estimate
// es : stopping criterion
// ea :approximate error
// maxit : maximum iterations
// iter : number of iteration
double test;
double xr=0;
double es,ea;
ja

double fxl,fxr;
int maxit=500,iter=0;
es=0.000001;
ea=1.1*es;
while((ea>es)&&(iter<maxit))
{
w.

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;
ww

else if(test<0.0) xu=xr;


else
{
xl=xr;
}
} //end of while
return xr;
}

250
251

public static double[] newton( double x[],fi_xi y,fij_xi dy)


{

m
//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;

o
int i;
int nmax=400;
double tolerance=1.0e-15;
int n=x.length;

i.c
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 )

dil
{
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;
}
va
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;
ja

int nmax=400;
double tolerance=1.0e-15;
int n=x.length;
double b[];
b=new double[n];
double dy[][];
w.

dy=new double[n][n];
i=0;
for(i=0;i<n;i++)
{
b[i]=1.0;
}
while( i++ < nmax && Matrix.abs(b) > tolerance )
{
ww

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);

251
252

}
if(i >= nmax) System.out.println("warning maximum number of iterations"+

m
" results may not be valid" );
return x;
}

//========= least square curve fitting methods ==========

//-------- polynomial least square curve fitting --------

o
public static double[] poly_least_square
(double xi[],double yi[],int n)
//polynomial least square curve fitting

i.c
//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;

dil
int np1=n+1;
double A[][];
A=new double[np1][np1];
double B[];
B=new double[np1];
double X[];
X=new double[np1];

for(i=0;i<n+1;i++)
va
{
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));
ja

}
for(k=0;k<l;k++)
{
if(i==0)
B[i]+= yi[k];
else
w.

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++)
ww

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

252
253

// least square curve fitting function


int n=e.length;

m
double ff;
if(n!=0.0)
{ ff=e[n-1];
for(int i=n-2;i>=0;i--)
{ ff=ff*x+e[i]; }
}
else

o
ff=0;
return ff;
}

i.c
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++)
{

dil
total+=(y[k]-f_least_square(e,x[k]))*(y[k]-f_least_square(e,x[k]));
}
total=Math.sqrt(total);
return total;
}

//-------End least square methods --------------------


//-------Orthogonal polynomial least square curve fitting ---
va
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;
ja

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];
w.

//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[];
ww

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[];

253
254

wi=new double[n];
//matrix<double> a(3,m+1);

m
double a[][];
a=new double[3][mp1];
for(i=0;i<n;i++)
{
p[1][i]=1.0;
p[0][i]=0.0;
}

o
gamma[0]=0;
for(i=0;i<n;i++)
{
gamma[0]+=wi[i];

i.c
}
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];

dil
}
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];
}
va
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];
ja

}
beta[j+1]=gamma[j+1]/gamma[j];
}
}//end of j
for(j=0;j<m+1;j++)
{
w.

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)


ww

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);

254
255

for(k=m-1;k>=0;k--)
{

m
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;
}

//minimization of a function

o
public static double amotry(double p[][], double y[], double psum[], int
ndim,
f_xi ff, int ihi, double fac)
{

i.c
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]) {

dil
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;
}
va
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];
ja

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;
}
w.

for (;;) {
ilo=1;
//ihi = y[1]>y[2] ? (inhi=2,1) : (inhi=1,2);
if(y[0]>y[1])
{
inhi=2;
ihi=1;
}
ww

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;

255
256

ihi=i;
} else if (y[i-1] > y[inhi-1] && i != ihi) inhi=i;

m
}
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;

o
for (i=1;i<=ndim;i++)
{
swap=p[0][i-1];
p[0][i-1]=p[ilo-1][i-1];

i.c
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])

dil
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-
va
1][j-1]);
p[i-1][j-1]=psum[j-
1];
y[i]=ff.func(psum,0);
}
}
nfunk += ndim;
for (j=1;j<=ndim;j++)
ja

{
for (sum=0.0,i=1;i<=mpts;i++) sum +=
p[i][j];
psum[j]=sum;
}
w.

}
} else --nfunk;
}
}

// differential equation solutions


public static double[] RK4(f_xi fp,double x0,double xn,double f0,int N)
{
ww

//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];

256
257

double xi[]=new double[2];


double k[];

m
k=new double[4];
int i;
double x;
fi[0]=f0;
for(x=x0,i=0;x<xn;x+=h,i++)
{
xi[0]=x;

o
xi[1]=fi[i];
k[0]=h*fp.func(xi,0);
xi[0]=x+h/2.0;
xi[1]=fi[i]+k[0]/2;

i.c
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;
}

dil
return fi;
}

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
va
// 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];
ja

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++)
w.

{
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;
ww

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;
}
}

257
258

return fi;
}

m
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

o
//Hmax : maximum possible step size
//Hmin : minimum possible step size
//k : Runge kutta coefficients
//Err : error

i.c
//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;

dil
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 )
va
{
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);
ja

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);
w.

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);
ww

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++;
}

258
259

else
{

m
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];

o
for(int i=0;i<=j;i++)
{
fj[0][i]=fi[0][i];
fj[1][i]=fi[1][i];

i.c
}
return fj;
}

//End of Class Numeric


}

dil
Numeric sınıfı örnek problemleri :

1. Non linear denklem çözümleri :

import java.io.*;
import Numeric;
import complex;
va
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;
ja

return b;
}
}

class df1 extends fij_xi


{
w.

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;
ww

return b;
}
}

class f2 extends f_x


{
double func(double x)
{
return Math.sin(x)-x/2;

259
260

}
}

m
class df2 extends f_x
{
double func(double x)
{
return Math.cos(x)-0.5;
}

o
}

class Matrix2

i.c
{
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();

dil
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;
va
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("");
ja

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 ");
w.

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));
ww

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 ");

260
261

System.out.println("fi(xi),i=1,n is given(derivative matrix is


notrequired)");

m
System.out.println(" "+Matrix.toStringT(Numeric.newton(x,b1)));

}
}

o
Çö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

i.c
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

f(x) is given only


Newton_2nd_derivative y,

f(x) is given only


Secant_2nd_derivative y,
dil
Newtons method with 2nd derivative y=f(x)=0

x= 1.895494267033981

Secant method with 2nd derivative y=f(x)=0

x= 1.895494267033981
va
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

Newtons method for system of equations


ja

yi=fi(xi)=0,i=0,n
fi(xi),i=1,n is given(derivative matrix is notrequired)
1.0673460858066897
0.1392276668868614

2. Türev – İntegral
w.

//======================================================
// Numerical Analysis package in java
// example to show utilisation of integration (integral)
// and differentiation (derivative) functions
// Dr. Turhan Coban
// =====================================================
ww

import java.io.*;
import Numeric;
import complex;

class f1 extends f_x


{
double func(double x)
{
return x*x;
}

261
262

m
class f2 extends f_x
{
double func(double x)
{
return x;
}
}

o
class fm1 extends f_xi
{
//multivariable function

i.c
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;

dil
}
return a;
}
}

class fm2 extends fi_xi


{
//multivariable function
double[] func(double x[])
va
{
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;
}
ja

class integ1
{
public static void main(String args[]) throws IOException
{
w.

f1 b1;
b1=new f1();
f2 b2;
b2=new f2();
fm1 b3;
b3=new fm1();
double x[];
fm2 b4;
ww

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));

262
263

System.out.println("integral of class f2 : "+


Numeric.integral(b2,0.0,1.0));

m
System.out.println("Derivative of class f1 : "+
Numeric.derivative(b1,1.0));
System.out.println("Derivative of class f2 : "+
Numeric.derivative(b2,1.0));

System.out.println("Derivative of fm1,0 : "+


Numeric.derivative(b3,1,x,0));

o
System.out.println("Derivative of fm2,0 : "+
Numeric.derivative(b4,1,x,0));
System.out.println("Derivative of fm1,0 : "+
Numeric.derivative(b3,1,x,0));

i.c
System.out.println("Derivative of fm2,0 : "+
Numeric.derivative(b4,1,x,0));
System.in.read();
}
}

çözüm :

integral of class

integral of class
Derivative of class
Derivative of class
Derivative of fm1,0
Derivative of fm2,0
Derivative of fm1,0
:
:
:
dil
f1 : 0.333333333333329
romberg integral of class f1 : 0.3333333333333333
f2 : 0.49999999999999384
f1 : 1.9999999999994864
f2 : 0.9999999999998606
3.0000000000028932
3.0000000000028932
3.0000000000028932
va
Derivative of fm2,0 : 3.0000000000028932

3. Least square polinom uydurma

//===========================================
// Polynomial least square curve fitting
// Dr. Turhan Coban
//===========================================
ja

import java.io.*;
import Numeric;
import Text;
w.

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[];
ww

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"));

263
264

int i=-1;
try {

m
while(fin != null)
{
i++;
xi[i]=Text.readDouble(fin);
yi[i]=Text.readDouble(fin);
System.out.println(" "+xi[i]+" "+yi[i]);
}

o
} 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);

i.c
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')
{

dil
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 : ");
va
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
ja

}//end of if
}
}

4. Diferansiyel denklemler :
w.

//======================================================
// Numerical Analysis package in java
// example to show differential equation solution
// and differentiation (derivative) functions
// Dr. Turhan Coban
// =====================================================
ww

import java.io.*;
import Numeric;
import complex;
import Matrix;

class fm1 extends f_xi


{
//multivariable function
double func(double x[],int x_ref)

264
265

{
//x[0] is x, x[1] is y

m
//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;
}
}

o
class dif1
{
public static void main(String args[]) throws IOException

i.c
{

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

dil
//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)));
}
}

1.0
1.02020134
1.0408107741377959
va
1.0618365464618167
1.0832870675613175
1.1051709179307265
1.1274968514019572
1.1502737986460576
1.1735108707455981
1.197217362839226
1.2214027578398445
ja

1.2460767302279048
1.271249149921327
1.2969300862235986
1.3231298118516308
1.3498588070449815
1.3771277637580916
w.

1.4049475899372086
1.4333294138837107
1.4622845887055762
1.4918246968587778
1.5219615547804188
1.5527072176154666
1.5840739840389706
1.6160744011756962
ww

1.648721269619143
1.682027648551951
1.7160068609697496
1.7506724990105325
1.7860384293916938
1.8221187989569014
1.8589280403350215
1.896480877713363
1.9347923327275491

265
266

1.9738777304703714
2.0137527056220317

m
2.0544332087042223
2.095935512460547
2.1382762183658373
2.1814722632669596
2.2255409261577848
2.270499835091013
2.3163669742296302

o
2.363160691040814
2.4108997036351645
2.4596031082541976
2.5092903869090972

i.c
2.5599814151737794
2.611696470135386
2.6644562385053905
2.7182818248945586

//======================================================
// Numerical Analysis package in java
// example to show differential equation solution

dil
// and differentiation (derivative) functions
// Dr. Turhan Coban
// =====================================================
import java.io.*;
import Numeric;
import complex;
import Matrix;
va
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;
ja

}
}

class dif2
{
w.

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
ww

//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))));
}
}

Cözüm :
0.0 -1.0

266
267

0.0050 -0.9950377826066799
0.01 -0.9901501844020889

m
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

o
0.049999999999999996-0.9536914203107341
0.05499999999999999-0.94945886933206
0.05999999999999999-0.9452972985683943
0.06499999999999999-0.9412063540290199

i.c
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

dil
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
va
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
ja

0.1950000000000001-0.8585128324297647
0.2000000000000001-0.856201234274326
0.2050000000000001-0.8539510362070005
0.2100000000000001-0.8517619320148359
0.2150000000000001-0.849633617012017
0.2200000000000001-0.8475657880322502
w.

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
ww

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

267
268

0.31000000000000016-0.8203512643245341
0.31500000000000017-0.8193770346977273

m
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

o
0.3550000000000002-0.8135307348695573
0.3600000000000002-0.8130393661162659
0.3650000000000002-0.812600319649468
0.3700000000000002-0.8122133345287916

i.c
0.3750000000000002-0.8118781511152201
0.3800000000000002-0.8115945110646018
0.38500000000000023-0.8113621573211925
0.39000000000000024-0.8111808341112298
0.39500000000000024-0.8110502869365394
0.4 -0.8109702625681743

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

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;
va
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];
ja

else return 0;
}
}

class dif3
w.

{
public static void main(String args[]) throws IOException
{

fm1 b3=new fm1();


double x[];
x=new double[1];
x[0]=1;
ww

//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();
}
}

Çözüm :

268
269

-1.0

m
-0.9960239680320001
-0.992095744511233
-0.9882151385858677
-0.9843819601659565
-0.9805960199203918
-0.9768571292738785

o
-0.9731651004039156
-0.9695197462377918
-0.9659208804495921
-0.9623683174572164
-0.9588618724194105

i.c
-0.955401361232808
-0.9519866005289858
-0.9486174076715289
-0.945293600753109
-0.942014998592574
-0.9387814207320486
-0.9355926874340476
-0.9324486196785992

dil
-0.9293490391603817
-0.9262937682858702
-0.9232826301704945
-0.9203154486358103
-0.9173920482066786
-0.9145122541084599
-0.9116758922642163
-0.9088827892919272
-0.9061327725017148
va
-0.903425669893081
-0.900761310152156
-0.898139522648956
-0.8955601374346547
-0.8930229852388627
-0.8905278974669202
-0.888074706197199
-0.8856632441784156
ja

-0.8832933448269559
-0.8809648422242088
-0.8786775711139124
-0.8764313668995095
-0.8742260656415141
-0.872061504054888
w.

-0.8699375195064296
-0.8678539500121697
-0.8658106342347813
-0.8638074114809979
-0.8618441216990421
-0.8599206054760645
-0.8580367040355941
-0.8561922592349969
ww

-0.854387113562946
-0.8526211101369017
-0.8508940927006006
-0.8492059056215563
-0.8475563938885688
-0.8459454031092447
-0.8443727795075264
-0.8428383699212321
-0.8413420217996048

269
270

-0.8398835832008722
-0.8384629027898148

m
-0.8370798298353451
-0.8357342142080957
-0.8344259063780173
-0.8331547574119857
-0.8319206189714199
-0.8307233433099079
-0.8295627832708429

o
-0.8284387922850687
-0.8273512243685349
-0.826299934119961
-0.8252847767185101

i.c
-0.8243056079214711
-0.8233622840619519
-0.8224546620465801
-0.8215825993532133
-0.8207459540286591
-0.8199445846864039
-0.8191783505043502
-0.8184471112225643

dil
-0.8177507271410314
-0.8170890591174206
-0.8164619685648588
-0.8158693174497131
-0.8153109682893825
-0.8147867841500976
-0.8142966286447304
-0.8138403659306118
-0.8134178607073579
va
-0.8130289782147054
-0.8126735842303556
-0.8123515450678265
-0.8120627275743135
-0.8118069991285605
-0.8115842276387357
-0.8113942815403203
-0.811237029794002
ja

-0.8111123418835786
-0.8110200878138704
-0.8109601381086393
w.
ww

270
271

m
EK A TEXT SINIFI

//============================================
// Numerical Analysis Package in Java
// Class Text to read data from screen or file
// and write (by using print) to screen or file

o
// formatted c printf like comand structure
// Dr. Turhan Coban
//============================================
import java.io.*;
import java.util.*;

i.c
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.

dil
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 :
va
--------- 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);
ja

------ printing data into a file "printfile.dat"----


PrintStream fout=new PrintStream
(new FileOutputStream("printfile.dat"));
String a="turhan";
fout.println(a);
----------------------------------------------------
w.

*/

public Text () {} ;
private static StringTokenizer T;
private static String S;

public static void prompt (String s) {


ww

System.out.print(s + " ");


System.out.flush();
}

public static int readInt (DataInputStream in) throws


IOException
{
if (T==null) refresh(in);
while (true)

271
272

{
try {

m
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.");}
}

o
}

public static char readChar (DataInputStream in) throws

i.c
IOException
{
if (T==null) refresh(in);
while (true)
{
try {
return T.nextToken().charAt(0);
}

dil
catch(NoSuchElementException e1) {refresh (in);}
}
}

public static double readDouble(DataInputStream in) throws


IOException
{
if(T==null) refresh(in);
va
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
ja

again.");
}
}
}

public static String readString(DataInputStream in) throws


w.

IOException
{
if(T==null) refresh (in);
while (true) {
try {return T.nextToken();}
catch (NoSuchElementException e1) {
refresh (in);
}
ww

}
}

public static String readStringLine(DataInputStream in) throws


IOException
{
//reads a line of strings from DataInputStream in
int ch;
String r = "";

272
273

boolean done = false;


while (!done)

m
{ try
{ ch = in.read();
if (ch < 0 || (char)ch == '\n' || (char)ch == '\0')
done = true;
else
r = r + (char) ch;
}

o
catch(java.io.IOException e)
{ done = true;
}
}

i.c
return r.substring(0,(r.length()-1));
}

private static void refresh (DataInputStream in) throws


IOException
{
S = in.readLine ();

dil
if (S==null) throw new EOFException();
T=new StringTokenizer (S);
}
/*
* 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.
va
* 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
ja

* 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
w.

* 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
ww

*/

/**
* 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

273
274

* become part of the formatted output. The format code directs the
* formatting of the (single) parameter to be formatted. The code has the

m
* 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

o
* <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

i.c
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

dil
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
va
* <dt>s <dd> string
* <dt>c <dd> character
* </dl>
* </ul>
* @exception IllegalArgumentException if bad format
*/

public Text(String s)
ja

{ width = 0;
precision = -1;
pre = "";
post = "";
leading_zeroes = false;
show_plus = false;
w.

alternate = false;
show_space = false;
left_align = false;
fmt = ' ';

int state = 0;
int length = s.length();
int parse_state = 0;
ww

// 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) == '%')

274
275

{ pre = pre + '%';


i++;

m
}
else
parse_state = 1;
}
else throw new java.lang.IllegalArgumentException();
}
else

o
pre = pre + s.charAt(i);
i++;
}
while (parse_state == 1)

i.c
{ 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++;

dil
}
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;
va
precision = 0;
i++;
}
else
parse_state = 4;
}
while (parse_state == 3)
{ if (i >= length) parse_state = 5;
ja

else if ('0' <= s.charAt(i) && s.charAt(i) <= '9')


{ precision = precision * 10 + s.charAt(i) - '0';
i++;
}
else
parse_state = 4;
w.

}
if (parse_state == 4)
{ if (i >= length) parse_state = 5;
else fmt = s.charAt(i);
i++;
}
if (i < length)
post = s.substring(i, length);
ww

/**
* prints a formatted number following printf conventions
* @param s a PrintStream
* @param fmt the format string
* @param x the double to print
*/

275
276

public static void print(java.io.PrintStream s, String fmt, double x)


{ s.print(new Text(fmt).form(x));

m
}

/**
* prints a formatted number following printf conventions
* @param s a PrintStream
* @param fmt the format string
* @param x the long to print

o
*/
public static void print(java.io.PrintStream s, String fmt, long x)
{ s.print(new Text(fmt).form(x));
}

i.c
/**
* prints a formatted number following printf conventions
* @param s a PrintStream
* @param fmt the format string
* @param x the character to
*/

dil
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
*/
va
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
ja

* @return the numeric value of the prefix of s representing a base 10


integer
*/

public static int atoi(String s)


{ return (int)atol(s);
w.

/**
* 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
*/
ww

public static long atol(String s)


{ int i = 0;

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);

276
277

else return parseLong(s, 8);


}

m
else return parseLong(s, 10);
}

private static long parseLong(String s, int base)


{ int i = 0;
int sign = 1;
long r = 0;

o
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++; }

i.c
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 ;

dil
else
return r * sign;
i++;
}
return r * sign;
}

/**
* Converts a string of digits to an double
va
* @param s a string
*/

public static double atof(String s)


{ int i = 0;
int sign = 1;
double r = 0; // integer part
double f = 0; // fractional part
ja

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++; }
w.

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');
ww

}
}
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);

277
278

}
else return sign * r;

m
i++;
}
return sign * r;
}

/**
* Formats a double into a string (like sprintf in C)

o
* @param x the number to format
* @return the formatted string
* @exception IllegalArgumentException if bad argument
*/

i.c
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);

dil
else if (fmt == 'e' || fmt == 'E' || fmt == 'g' || fmt == 'G')
r = exp_Text(x);
else throw new java.lang.IllegalArgumentException();

return pad(sign(s, r));


}

/**
* Formats a long integer into a string (like sprintf in C)
va
* @param x the number to format
* @return the formatted string
*/

public String form(long x)


{ String r;
int s = 0;
if (fmt == 'd' || fmt == 'i')
ja

{ s = 1;
if (x < 0) { x = -x; s = -1; }
r = "" + x;
}
else if (fmt == 'o')
r = convert(x, 3, 7, "01234567");
w.

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();

return pad(sign(s, r));


}
ww

/**
* Formats a character into a string (like sprintf in C)
* @param x the value to format
* @return the formatted string
*/

public String form(char c)


{ if (fmt != 'c')

278
279

throw new java.lang.IllegalArgumentException();

m
String r = "" + c;
return pad(r);
}

/**
* Formats a string into a larger string (like sprintf in C)
* @param x the value to format

o
* @return the formatted string
*/

public String form(String s)

i.c
{ if (fmt != 's')
throw new java.lang.IllegalArgumentException();
if (precision >= 0) s = s.substring(0, precision);
return pad(s);
}

/**

dil
* a test stub for the format class
*/

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;
va
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);
ja

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);

Text.print(System.out, "x = |%e|\n", x);


w.

Text.print(System.out, "u = |%20e|\n", u);


Text.print(System.out, "x = |% .5e|\n", x);
Text.print(System.out, "w = |%20.5e|\n", w);
Text.print(System.out, "x = |%020.5e|\n", x);
Text.print(System.out, "x = |%+20.5e|\n", x);
Text.print(System.out, "x = |%+020.5e|\n", x);
Text.print(System.out, "x = |% 020.5e|\n", x);
Text.print(System.out, "y = |%#+20.5e|\n", y);
ww

Text.print(System.out, "y = |%-+20.5e|\n", y);

Text.print(System.out, "x = |%g|\n", x);


Text.print(System.out, "z = |%g|\n", z);
Text.print(System.out, "w = |%g|\n", w);
Text.print(System.out, "u = |%g|\n", u);
Text.print(System.out, "y = |%.2g|\n", y);
Text.print(System.out, "y = |%#.2g|\n", y);

279
280

Text.print(System.out, "d = |%d|\n", d);


Text.print(System.out, "d = |%20d|\n", d);

m
Text.print(System.out, "d = |%020d|\n", d);
Text.print(System.out, "d = |%+20d|\n", d);
Text.print(System.out, "d = |% 020d|\n", d);
Text.print(System.out, "d = |%-20d|\n", d);
Text.print(System.out, "d = |%20.8d|\n", d);
Text.print(System.out, "d = |%x|\n", d);
Text.print(System.out, "d = |%20X|\n", d);

o
Text.print(System.out, "d = |%#20x|\n", d);
Text.print(System.out, "d = |%020X|\n", d);
Text.print(System.out, "d = |%20.8x|\n", d);
Text.print(System.out, "d = |%o|\n", d);

i.c
Text.print(System.out, "d = |%020o|\n", d);
Text.print(System.out, "d = |%#20o|\n", d);
Text.print(System.out, "d = |%#020o|\n", d);
Text.print(System.out, "d = |%20.12o|\n", d);

Text.print(System.out, "s = |%-20s|\n", "Hello");


Text.print(System.out, "s = |%-20c|\n", '!');
}

}
dil
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();
va
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;
ja

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;
w.

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 = " ";
ww

}
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)

280
281

w = width;
else if ((fmt == 'd' || fmt == 'i' || fmt == 'x' || fmt == 'X' || fmt

m
== 'o')
&& precision > 0) w = precision;

return p + repeat('0', w - p.length() - r.length()) + r;


}

o
private String fixed_Text(double d)
{ String f = "";

if (d > 0x7FFFFFFFFFFFFFFFL) return exp_Text(d);

i.c
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);

dil
}

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;
va
i++)
{ factor *= 10;
leading_zeroes = leading_zeroes + "0";
}
long l = (long) (factor * fr + 0.5);

z = leading_zeroes + l;
z = z.substring(z.length() - precision, z.length());
ja

if (precision > 0 || alternate) z = "." + z;


if ((fmt == 'G' || fmt == 'g') && !alternate)
// remove trailing zeroes and decimal point
w.

{ 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);
}
return z;
}
ww

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);

281
282

d = d * factor;

m
f = f + fixed_Text(d);

if (fmt == 'e' || fmt == 'g')


f = f + "e";
else
f = f + "E";

o
String p = "000";
if (e >= 0)
{ f = f + "+";
p = p + e;

i.c
}
else
{ f = f + "-";
p = p + (-e);
}

return f + p.substring(p.length() - 3, p.length());


}

private
private
private
private
private
private
private
private
int width;
int precision;
String pre;
String post;
dil
boolean leading_zeroes;
boolean show_plus;
boolean alternate;
boolean show_space;
va
private boolean left_align;
private char fmt; // one of cdeEfgGiosxXos
}
ja
w.
ww

282
283

m
EK B JAVA KÜTÜPHANESİ İNDEKSİ

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,

o
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

i.c
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)

dil
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)
va
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)
ja

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
w.

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,
ww

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

283
284

class java.awt.Dialog
class java.awt.FileDialog

m
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)

o
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)

i.c
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

dil
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
va
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)
ja

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
w.

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)
ww

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

284
285

class java.awt.event.WindowEvent
class java.awt.event.ItemEvent

m
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

o
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)

i.c
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

dil
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
va
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)
ja

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
w.

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
ww

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

285
286

class java.util.zip.ZipInputStream (implements java.util.zip.ZipConstants)


class java.io.LineNumberInputStream

m
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)

o
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

i.c
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

dil
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)
va
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)
ja

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)
w.

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
ww

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

286
287

class java.rmi.server.Operation
class java.io.OutputStream

m
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

o
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)

i.c
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)

dil
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
va
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)
ja

class java.io.Reader
class java.io.BufferedReader
class java.io.LineNumberReader
class java.io.CharArrayReader
class java.io.FilterReader
class java.io.PushbackReader
w.

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
ww

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

287
288

class sun.tools.debug.RemoteDouble
class sun.tools.debug.RemoteFloat

m
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

o
class sun.tools.debug.RemoteShort
class java.util.ResourceBundle
class java.util.ListResourceBundle
class java.util.PropertyResourceBundle
interface java.sql.ResultSet

i.c
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

dil
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)
va
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,
ja

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)
w.

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
ww

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

288
289

class java.lang.ThreadDeath
class java.lang.VirtualMachineError

m
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

o
class java.lang.ClassNotFoundException
class java.lang.CloneNotSupportedException
class java.rmi.server.ServerCloneException
class java.util.zip.DataFormatException
class java.security.DigestException

i.c
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

dil
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
va
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
ja

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
w.

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
ww

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

289
290

class java.security.NoSuchAlgorithmException
class java.lang.NoSuchFieldException

m
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

o
class java.lang.ArithmeticException
class java.lang.ArrayStoreException
class java.lang.ClassCastException
class java.util.EmptyStackException
class java.lang.IllegalArgumentException

i.c
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

dil
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
va
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
ja

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
w.

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)
ww

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

290
291

EK C JAVADA KULLANILAN METODLARIN LİSTESİ

m
Not : Bu liste ingilizce açıklamalarıyla verilmiştir. Listenin Türkçesi hazırlanacaktır.

a. Variable in class java.awt.AWTEventMulticaster


ABORT. Static variable in interface java.awt.image.ImageObserver

o
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

i.c
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

dil
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.
va
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.
ja

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
w.

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.
ww

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.

291
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

m
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

o
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.

i.c
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.

dil
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
va
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
ja

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.
w.

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.
ww

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

292
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.

m
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.

o
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

i.c
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.

dil
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.
va
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
ja

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
w.

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
ww

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

293
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.

m
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

o
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.

i.c
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.

dil
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
va
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
ja

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.
w.

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.
ww

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.

294
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

m
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.

o
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

i.c
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.

dil
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.
va
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.
ja

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
w.

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
ww

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.

295
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

m
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

o
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.

i.c
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.

dil
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
va
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.
ja

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
w.

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
ww

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.

296
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

m
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

o
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.

i.c
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

dil
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.
va
B

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
ja

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
w.

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.
ww

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.

297
298

BigDecimal(BigInteger). Constructor for class java.math.BigDecimal


Translates a BigInteger into a BigDecimal.
BigDecimal(BigInteger, int). Constructor for class java.math.BigDecimal

m
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

o
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.

i.c
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

dil
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.
va
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.
ja

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
w.

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.
ww

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

298
299

Constructor.
breakpointEvent(RemoteThread). Method in interface sun.tools.debug.DebuggerCallback
A breakpoint has been hit in the specified thread.

m
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

o
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

i.c
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.

dil
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.
va
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.
ja

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
w.

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
ww

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

299
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.

m
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.

o
C

calendar. Variable in class java.text.DateFormat


The calendar that DateFormat uses to produce the time field values needed to implement date/time formatting.

i.c
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.

dil
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.
va
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.
ja

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.
w.

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
ww

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

300
301

Creates a new CharArrayWriter.


CharArrayWriter(int). Constructor for class java.io.CharArrayWriter
Creates a new CharArrayWriter with the specified initial size.

m
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

o
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

i.c
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.

dil
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
va
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
ja

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.
w.

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.
ww

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.

301
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

m
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

o
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.

i.c
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.

dil
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
va
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.
ja

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
w.

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
ww

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

302
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

m
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.

o
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

i.c
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

dil
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
va
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.
ja

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
w.

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
ww

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

303
304

ClassNotFoundException(). Constructor for class java.lang.ClassNotFoundException


Constructs a ClassNotFoundException with no detail message.
ClassNotFoundException(String). Constructor for class java.lang.ClassNotFoundException

m
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

o
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

i.c
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

dil
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
va
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
ja

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
w.

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.
ww

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.

304
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

m
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

o
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.

i.c
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.

dil
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
va
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.
ja

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
w.

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
ww

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

305
306

Closes the stream.


close(). Method in class java.io.OutputStream
Closes this output stream and releases any system resources associated with this stream.

m
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.

o
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

i.c
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

dil
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
va
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.
ja

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
w.

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).
ww

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.

306
307

columnNullableUnknown. Static variable in interface java.sql.ResultSetMetaData


Nullability unknown.
columnWeights. Variable in class java.awt.GridBagLayout

m
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

o
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.

i.c
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.

dil
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
va
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
ja

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.
w.

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.
ww

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

307
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.

m
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.

o
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.

i.c
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.

dil
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
va
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
ja

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
w.

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
ww

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

308
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.

m
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

o
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.

i.c
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

dil
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.
va
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.
ja

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
w.

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
ww

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.

309
310

countStackFrames(). Method in class java.lang.Thread


Counts the number of stack frames in this thread.
countTokens(). Method in class java.util.StringTokenizer

m
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

o
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

i.c
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

dil
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.
va
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
ja

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
w.

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
ww

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

310
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.

m
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

o
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

i.c
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()).

dil
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
va
Creates a new cursor object with the specified type.
cyan. Static variable in class java.awt.Color
The color cyan.

darker(). Method in class java.awt.Color


Returns a darker version of this color.
ja

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?
w.

DataFlavor(Class, String). Constructor for class java.awt.datatransfer.DataFlavor


Construct a DataFlavor that represents a Java class

The returned DataFlavor will have the following characteristics

representationClass = representationClass
mimeType = application/x-javaserializedobject

DataFlavor(String, String). Constructor for class java.awt.datatransfer.DataFlavor


Construct a DataFlavor that represents a MimeType
ww

The returned DataFlavor will have the following characteristics:

If the mimeType is "application/x-javaserializedobject; class=", the result is the same as calling new
DataFlavor(Class:forName() as above

otherwise:

representationClass = InputStream
mimeType = mimeType

DataFormatException(). Constructor for class java.util.zip.DataFormatException

311
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.

m
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.

o
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.

i.c
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

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

dil
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
va
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
ja

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
w.

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
ww

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

312
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.

m
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.

o
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

i.c
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

dil
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.
va
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.
ja

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
w.

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
ww

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

313
314

Deletes an owner.
deleteShortcut(). Method in class java.awt.MenuItem
Delete any MenuShortcut associated with this MenuItem.

m
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

o
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

i.c
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

dil
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
va
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
ja

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.
w.

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
ww

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

314
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.

m
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

o
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

i.c
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

dil
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
va
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
ja

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?
w.

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.
ww

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

315
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

m
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.

o
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

i.c
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

dil
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
va
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
ja

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
w.

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.
ww

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.

316
317

dumpStack(). Method in class sun.tools.debug.RemoteThread


Dump the stack.
dumpStack(). Static method in class java.lang.Thread

m
Prints a stack trace of the current thread.

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.

o
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.

i.c
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

dil
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.
va
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.
ja

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
w.

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.
ww

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.

317
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

m
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

o
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.

i.c
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

dil
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.
va
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.
ja

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
w.

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.
ww

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.

318
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

m
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

o
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.

i.c
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.

dil
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
va
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
ja

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.
w.

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.
ww

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.

319
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

m
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

o
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.

i.c
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.

dil
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
va
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
ja

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
w.

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
ww

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.

320
321

executeCall(). Method in interface java.rmi.server.RemoteCall


Do whatever it takes to execute the call.
executeQuery(). Method in interface java.sql.PreparedStatement

m
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

o
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.

i.c
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.

dil
exportObject(Remote, Object). Method in interface java.rmi.server.ServerRef
Find or create a client stub object for the supplied Remote.

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.
va
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.
ja

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
w.

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
ww

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

321
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.

m
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.

o
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

i.c
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.

dil
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
va
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.
ja

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).
w.

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
ww

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.

322
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

m
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

o
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.

i.c
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.

dil
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.
va
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.
ja

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
w.

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
ww

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.

323
324

floatValue(). Method in class java.lang.Byte


Returns the value of this Byte as a float.
floatValue(). Method in class java.lang.Double

m
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

o
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

i.c
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

dil
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.
va
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.
ja

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
w.

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
ww

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

324
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

m
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.

o
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

i.c
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

dil
Overrides DateFormat

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.
va
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.
ja

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
w.

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
ww

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

325
326

Returns the amount of free memory in the system.


FRENCH. Static variable in class java.util.Locale
Useful constant for language.

m
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.

o
G

i.c
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.

dil
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
va
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
ja

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.
w.

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.
ww

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.

326
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

m
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

o
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.

i.c
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.

dil
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
va
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
ja

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.
w.

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.
ww

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.

327
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

m
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

o
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

i.c
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

dil
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.
va
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.
ja

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
w.

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
ww

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.

328
329

getBounds(). Method in interface java.awt.Shape


Return the bounding box of the shape.
getBuffer(). Method in class java.io.StringWriter

m
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

o
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.

i.c
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.

dil
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
va
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?
ja

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
w.

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
ww

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

329
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

m
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

o
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.

i.c
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

dil
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.
va
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
ja

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?
w.

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.
ww

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.

330
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

m
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

o
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

i.c
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

dil
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.
va
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.
ja

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
w.

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.
ww

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

331
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

m
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

o
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

i.c
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.

dil
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
va
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
ja

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.
w.

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.
ww

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

332
333

Gets the default TimeZone for this host.


getDefaultAllowUserInteraction(). Static method in class java.net.URLConnection
Returns the default value of the allowUserInteraction field.

m
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

o
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.

i.c
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.

dil
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
va
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.
ja

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
w.

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
ww

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

333
334

What's the version of this JDBC driver?


getEchoChar(). Method in class java.awt.TextField
Returns the character to be used for echoing.

m
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

o
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.

i.c
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.

dil
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
va
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.
ja

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
w.

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 _).
ww

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.

334
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

m
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

o
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

i.c
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

dil
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.
va
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.
ja

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
w.

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
ww

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.

335
336

getFontMetrics(). Method in class java.awt.Graphics


Gets the font metrics of the current font.
getFontMetrics(Font). Method in class java.awt.Component

m
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.

o
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

i.c
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

dil
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
va
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
ja

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
w.

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
ww

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

336
337

Returns the horizontal gap between components.


getHgap(). Method in class java.awt.CardLayout
Returns the horizontal gap between components.

m
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"

o
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

i.c
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

dil
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.
va
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.
ja

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
w.

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.
ww

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

337
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.

m
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.

o
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

i.c
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

dil
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
va
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
ja

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
w.

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
ww

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

338
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.

m
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.

o
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

i.c
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

dil
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.
va
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".
ja

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
w.

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
ww

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

339
340

Returns the alignment along the y axis.


getLayoutAlignmentY(Container). Method in class java.awt.CardLayout
Returns the alignment along the y axis.

m
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

o
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.

i.c
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

dil
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.
va
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
ja

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.
w.

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.
ww

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.

340
341

getLocation(). Method in class java.awt.Component


Returns the current location of this component.
getLocation(). Method in class java.awt.Point

m
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.

o
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

i.c
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

dil
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
va
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
ja

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?
w.

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?
ww

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

341
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.

m
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.

o
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

i.c
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

dil
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.
va
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.
ja

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
w.

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.
ww

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

342
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.

m
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.

o
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

i.c
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.

dil
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.
va
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
ja

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
w.

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
ww

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

343
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.

m
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.

o
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

i.c
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.

dil
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
va
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
ja

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.
w.

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
ww

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

344
345

Get the exception chained to this one.


getNextWarning(). Method in class java.sql.SQLWarning
Get the warning chained to this one

m
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.

o
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

i.c
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

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

dil
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.
va
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.
ja

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.
w.

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
ww

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

345
346

Returns the parent directory of the file represented by this object.


getParent(). Method in class java.awt.MenuComponent
Returns the parent container.

m
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.

o
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

i.c
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).

dil
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
va
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
ja

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
w.

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.
ww

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.

346
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

m
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

o
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.

i.c
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.

dil
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
va
getPropertyInfo(String, Properties). Method in interface java.sql.Driver

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.
ja

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
w.

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
ww

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.

347
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

m
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

o
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.

i.c
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

dil
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
va
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
ja

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.
w.

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.
ww

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.

348
349

getScreenResolution(). Method in class java.awt.Toolkit


Returns the screen resolution in dots-per-inch.
getScreenSize(). Method in class java.awt.Toolkit

m
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

o
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.

i.c
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.

dil
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
va
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.
ja

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
w.

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.
ww

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

349
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.

m
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

o
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.

i.c
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.

dil
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
va
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.
ja

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
w.

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
ww

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

350
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.

m
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

o
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.

i.c
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

dil
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.
va
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.
ja

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.
w.

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.
ww

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.

351
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

m
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

o
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.

i.c
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

dil
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.
va
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.
ja

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
w.

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
ww

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.

352
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

m
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

o
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.

i.c
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

dil
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
va
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
ja

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
w.

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
ww

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).

353
354

getWidth(ImageObserver). Method in class java.awt.Image


Gets the actual width of the image.
getWidths(). Method in class java.awt.FontMetrics

m
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

o
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

i.c
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

dil
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
va
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
ja

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.
w.

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.
ww

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

354
355

GZIP header magic number.


GZIPInputStream(InputStream). Constructor for class java.util.zip.GZIPInputStream
Creates a new input stream with a default buffer size.

m
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.

o
H

HAND_CURSOR. Static variable in class java.awt.Cursor


The hand cursor type.

i.c
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

dil
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.
va
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.
ja

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
w.

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
ww

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

355
356

Returns a hashcode for this Integer.


hashCode(). Method in class java.util.Locale
Override hashCode.

m
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

o
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

i.c
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

dil
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.
va
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.
ja

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
w.

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
ww

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.

356
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

m
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

o
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

i.c
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

dil
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
va
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
ja

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.
w.

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
ww

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.

357
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

m
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.

o
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

i.c
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.

dil
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
va
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
ja

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
w.

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.
ww

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

358
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.

m
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.

o
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.

i.c
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

dil
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.
va
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.
ja

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
w.

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
ww

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

359
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

m
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

o
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.

i.c
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.

dil
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
va
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
ja

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
w.

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
ww

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

360
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.

m
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

o
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

i.c
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

dil
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
va
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
ja

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.
w.

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.
ww

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

361
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).

m
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.

o
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

i.c
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

dil
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
va
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.
ja

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
w.

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
ww

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?

362
363

isBold(). Method in class java.awt.Font


Returns true if the font is bold.
isBound(). Method in class java.beans.PropertyDescriptor

m
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

o
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.

i.c
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

dil
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.
va
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.
ja

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
w.

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
ww

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.

363
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

m
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

o
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.

i.c
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.

dil
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
va
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.
ja

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.
w.

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.
ww

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.

364
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

m
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

o
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

i.c
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

dil
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.
va
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.
ja

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.
w.

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.
ww

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.

365
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

m
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

o
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.

i.c
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.

dil
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
va
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
ja

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.
w.

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
ww

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

366
367

Useful constant for month.


JUNE. Static variable in class java.util.Calendar
Useful constant for month.

m
K

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

o
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.

i.c
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.

dil
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.
va
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.
ja

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.
w.

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
ww

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.

367
368

Label(). Constructor for class java.awt.Label


Constructs an empty label.
Label(String). Constructor for class java.awt.Label

m
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

o
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.

i.c
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

dil
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
va
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
ja

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
w.

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
ww

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

368
369

Returns the length of this string.


length(). Method in class java.lang.StringBuffer
Returns the length (character count) of this string buffer.

m
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.

o
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

i.c
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

dil
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.
va
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.
ja

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
w.

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
ww

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.

369
370

LOAD_FILE. Static variable in class java.awt.Event


A file loading event.
loadClass(String). Method in class java.lang.ClassLoader

m
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

o
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.

i.c
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.

dil
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
va
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.
ja

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
w.

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
ww

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

370
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.

m
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

o
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.

i.c
M

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

dil
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
va
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
ja

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.
w.

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.
ww

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.

371
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

m
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

o
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

i.c
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

dil
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.
va
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
ja

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.
w.

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.
ww

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.

372
373

menu. Static variable in class java.awt.SystemColor


The background color for menus.
Menu(). Constructor for class java.awt.Menu

m
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

o
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

i.c
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

dil
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.
va
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
ja

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.
w.

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.
ww

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.

373
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

m
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

o
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

i.c
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

dil
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.
va
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
ja

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.
w.

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.
ww

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.

374
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

m
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

o
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

i.c
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

dil
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
va
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
ja

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
w.

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
ww

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.

375
376

multiply(BigInteger). Method in class java.math.BigInteger


Returns a BigInteger whose value is (this * val).

m
N

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

o
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.

i.c
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

dil
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
va
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
ja

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
w.

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
ww

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.

376
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

m
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

o
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

i.c
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

dil
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
va
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
ja

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.
w.

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.
ww

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

377
378

Constructor with a detail message.


NoSuchAlgorithmException(). Constructor for class java.security.NoSuchAlgorithmException
Constructs a NoSuchAlgorithmException with no detail message.

m
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.

o
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

i.c
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.

dil
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
va
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
ja

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.
w.

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
ww

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

378
379

Are NULL values sorted low?


NUM_COLORS. Static variable in class java.awt.SystemColor
The number of system colors in the array.

m
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.

o
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.

i.c
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

Object(). Constructor for class java.lang.Object


ObjectInputStream(InputStream). Constructor for class java.io.ObjectInputStream

dil
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.
va
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.
ja

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
w.

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
ww

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

379
380

The underlying output stream.


out. Variable in class java.io.FilterWriter
The underlying character-output stream.

m
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

o
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.

i.c
owner. Variable in class java.awt.datatransfer.Clipboard

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

dil
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
va
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.
ja

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
w.

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.
ww

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

380
381

paramString(). Method in class java.awt.Dialog


Returns the parameter String of this Dialog.
paramString(). Method in class java.awt.Event

m
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

o
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

i.c
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.

dil
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
va
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
ja

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.
w.

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.
ww

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.

381
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

m
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

o
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.

i.c
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.

dil
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.
va
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
ja

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.
w.

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
ww

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"

382
383

play(). Method in interface java.applet.AudioClip


Starts playing this audio clip.

m
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).

o
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

i.c
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

dil
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.
va
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
ja

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.
w.

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
ww

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

383
384

preferredSize(int). Method in interface java.awt.peer.ListPeer


DEPRECATED: Replaced by getPreferredSize(int).
preferredSize(int). Method in class java.awt.TextField

m
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

o
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

i.c
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

dil
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
va
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
ja

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.
w.

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
ww

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

384
385

The PrintScreen action-key.


printAll(Graphics). Method in class java.awt.Component
Prints the component and its subcomponents.

m
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

o
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.

i.c
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.

dil
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
va
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
ja

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
w.

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
ww

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

385
386

PRIVATE_USE. Static variable in class java.lang.Character


procedureColumnIn. Static variable in interface java.sql.DatabaseMetaData
COLUMN_TYPE - IN parameter.

m
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.

o
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

i.c
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

dil
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
va
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
ja

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.
w.

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.
ww

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.

386
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

m
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.

o
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

i.c
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.

dil
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
va
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.
ja

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.
w.

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
ww

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.

387
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

m
Specifies that matching pairs of this character delimit string constants in this tokenizer.

random(). Static method in class java.lang.Math


Returns a random number between 0.0 and 1.0.

o
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

i.c
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

dil
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.
va
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.
ja

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
w.

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
ww

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

388
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.

m
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.

o
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

i.c
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

dil
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.
va
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.
ja

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
w.

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
ww

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

389
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.

m
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.

o
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

i.c
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

dil
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
va
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
ja

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.
w.

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.
ww

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.

390
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

m
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

o
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.

i.c
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.

dil
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
va
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
ja

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.
w.

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
ww

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

391
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.

m
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.

o
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.

i.c
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

dil
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.
va
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.
ja

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
w.

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
ww

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.

392
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

m
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

o
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.

i.c
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

dil
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.
va
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
ja

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
w.

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
ww

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.

393
394

removeCertificate(Certificate). Method in class java.security.Identity


Removes a certificate from this identity.
removeComponentListener(ComponentListener). Method in class java.awt.Component

m
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

o
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.

i.c
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.

dil
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
va
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
ja

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.
w.

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.
ww

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.

394
395

removePropertyChangeListener(PropertyChangeListener). Method in interface java.beans.Customizer


Remove a listener for the PropertyChange event.
removePropertyChangeListener(PropertyChangeListener). Method in class java.beans.PropertyChangeSupport

m
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

o
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.

i.c
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.

dil
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
va
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
ja

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.
w.

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.
ww

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

395
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.

m
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.

o
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

i.c
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

dil
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
va
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.
ja

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.
w.

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
ww

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

396
397

Constructs a RMISecurityException with the specified detail message.


RMISecurityManager(). Constructor for class java.rmi.RMISecurityManager
Construct and initialize.

m
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.

o
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

i.c
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.

dil
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.
va
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.
ja

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
w.

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.

S
ww

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

397
398

A file saving event.


saveInternal(ObjectOutputStream, String). Method in class java.awt.AWTEventMulticaster
scale(). Method in class java.math.BigDecimal

m
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

o
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.

i.c
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.

dil
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
va
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
ja

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
w.

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
ww

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.

398
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.

m
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.

o
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.

i.c
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.

dil
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
va
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
ja

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.
w.

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
ww

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.

399
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.

m
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

o
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

i.c
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

dil
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.
va
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
ja

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
w.

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
ww

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

400
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

m
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.

o
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

i.c
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

dil
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
va
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.
ja

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
w.

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
ww

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

401
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.

m
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

o
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

i.c
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.

dil
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
va
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
ja

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
w.

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.
ww

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

402
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.

m
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

o
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.

i.c
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

dil
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
va
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
ja

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.
w.

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.
ww

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

403
404

value.
setFollowRedirects(boolean). Static method in class java.net.HttpURLConnection
Sets whether HTTP redirects (requests with response code 3xx) should be automatically followed

m
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.

o
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.

i.c
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.

dil
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.
va
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.
ja

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
w.

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.
ww

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

404
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.

m
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

o
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.

i.c
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

dil
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
va
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
ja

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
w.

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.
ww

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.

405
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

m
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

o
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

i.c
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.

dil
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.
va
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.
ja

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
w.

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
ww

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

406
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.

m
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

o
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

i.c
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

dil
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

Set the value of a parameter using an object; use the java.lang equivalent objects for
integral values.
va
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
ja

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
w.

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
ww

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

407
408

retrieve the pixels.


setPixels(int, int, int, int, ColorModel, byte[], int, int). Method in class
java.awt.image.ReplicateScaleFilter

m
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

o
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

i.c
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

dil
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
va
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.
ja

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
w.

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.
ww

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

408
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.

m
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

o
OPTIONS
PUT
DELETE
TRACE
are legal, subject to protocol restrictions.

i.c
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.

dil
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.
va
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
ja

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.
w.

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
ww

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

409
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.

m
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.

o
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

i.c
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

dil
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.
va
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.
ja

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
w.

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
ww

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.

410
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

m
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

o
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

i.c
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.

dil
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
va
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.
ja

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
w.

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.
ww

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

411
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.

m
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

o
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).

i.c
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.

dil
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
va
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.
ja

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
w.

Replaces the Web page currently being viewed with the given URL.
showDocument(URL, String). Method in interface java.applet.AppletContext
Requests that the browser or applet viewer show the Web page indicated by the url argument.
showStatus(String). Method in class java.applet.Applet
Requests that the argument string be displayed in the "status window".
showStatus(String). Method in interface java.applet.AppletContext
Requests that the argument string be displayed in the "status window".
SIGN. Static variable in class java.security.Signature
Possible state value, signifying that this signature object has been initialized for signing.
sign(). Method in class java.security.Signature
ww

Returns the signature bytes of all the data updated.


Signature(String). Constructor for class java.security.Signature
Creates a Signature object for the specified algorithm.
SignatureException(). Constructor for class java.security.SignatureException
Constructs a SignatureException with no detail message.
SignatureException(String). Constructor for class java.security.SignatureException
Constructs a SignatureException with the specified detail message.
Signer(). Constructor for class java.security.Signer
Creates a signer.
Signer(String). Constructor for class java.security.Signer
Creates a signer with the specified identity name.
Signer(String, IdentityScope). Constructor for class java.security.Signer

412
413

Creates a signer with the specified identity name and scope.


signum(). Method in class java.math.BigDecimal
Returns the signum function of this number (i.e., -1, 0 or 1 as the value of this number is

m
negative, zero or positive).
signum(). Method in class java.math.BigInteger
Returns the signum function of this number (i.e., -1, 0 or 1 as the value of this number is
negative, zero or positive).
SILENT. Static variable in class java.rmi.server.LogStream
constants for logging levels
SimpleBeanInfo(). Constructor for class java.beans.SimpleBeanInfo
SimpleDateFormat(). Constructor for class java.text.SimpleDateFormat

o
Construct a SimpleDateFormat using the default pattern for the default locale.
SimpleDateFormat(String). Constructor for class java.text.SimpleDateFormat
Construct a SimpleDateFormat using the given pattern in the default locale.
SimpleDateFormat(String, DateFormatSymbols). Constructor for class java.text.SimpleDateFormat
Construct a SimpleDateFormat using the given pattern and locale-specific symbol data.

i.c
SimpleDateFormat(String, Locale). Constructor for class java.text.SimpleDateFormat
Construct a SimpleDateFormat using the given pattern and locale.
SimpleTimeZone(int, String). Constructor for class java.util.SimpleTimeZone
Constructs a SimpleTimeZone with the given base time zone offset from GMT and time zone ID.
SimpleTimeZone(int, String, int, int, int, int, int, int, int, int). Constructor for class
java.util.SimpleTimeZone
Constructs a SimpleTimeZone with the given base time zone offset from GMT, time zone ID, time
to start and end the daylight time.
SIMPLIFIED_CHINESE. Static variable in class java.util.Locale
Useful constant for language.

dil
sin(double). Static method in class java.lang.Math
Returns the trigonometric sine of an angle.
SINGLEFRAME. Static variable in interface java.awt.image.ImageConsumer
The image contain a single static image.
SINGLEFRAMEDONE. Static variable in interface java.awt.image.ImageConsumer
One frame of the image is complete but there are more frames to be delivered.
SINGLEPASS. Static variable in interface java.awt.image.ImageConsumer
The pixels will be delivered in a single pass.
size. Variable in class java.awt.Font
The point size of this font.
size(). Method in class java.util.BitSet
va
Returns the number of bits currently in this bit set.
size(). Method in class java.io.ByteArrayOutputStream
Returns the current size of the buffer.
size(). Method in class java.io.CharArrayWriter
Returns the current size of the buffer.
size(). Method in class java.awt.Component
size(). Method in class java.io.DataOutputStream
Returns the number of bytes written to this data output stream.
size(). Method in class java.util.Dictionary
Returns the number of keys in this dictionary.
ja

size(). Method in class java.util.Hashtable


Returns the number of keys in this hashtable.
size(). Method in class java.security.IdentityScope
Returns the number of identities within this identity scope.
size(). Method in class java.util.Vector
Returns the number of components in this vector.
SkeletonMismatchException(String). Constructor for class java.rmi.server.SkeletonMismatchException
w.

Create a new SkeletonMismatchException exception with a descriptive string.


SkeletonNotFoundException(String). Constructor for class java.rmi.server.SkeletonNotFoundException
Create a new SkeletonNotFoundException exception with a descriptive string.
SkeletonNotFoundException(String, Exception). Constructor for class
java.rmi.server.SkeletonNotFoundException
Create a new SkeletonNotFoundException with a descriptive string and an exception.
skip(long). Method in class java.io.BufferedInputStream
Skips over and discards n bytes of data from the input stream.
skip(long). Method in class java.io.BufferedReader
Skip characters.
ww

skip(long). Method in class java.io.ByteArrayInputStream


Skips n bytes of input from this input stream.
skip(long). Method in class java.io.CharArrayReader
Skip characters.
skip(long). Method in class java.util.zip.CheckedInputStream
Skips specified number of bytes of input.
skip(long). Method in class java.io.FileInputStream
Skips over and discards n bytes of data from the input stream.
skip(long). Method in class java.io.FilterInputStream
Skips over and discards n bytes of data from the input stream.
skip(long). Method in class java.io.FilterReader
Skip characters.

413
414

skip(long). Method in class java.util.zip.InflaterInputStream


Skips specified number of bytes of uncompressed data.
skip(long). Method in class java.io.InputStream

m
Skips over and discards n bytes of data from this input stream.
skip(long). Method in class java.io.LineNumberInputStream
Skips over and discards n bytes of data from the input stream.
skip(long). Method in class java.io.LineNumberReader
Skip characters.
skip(long). Method in interface java.io.ObjectInput
Skips n bytes of input.
skip(long). Method in class java.io.Reader

o
Skip characters.
skip(long). Method in class java.io.StringBufferInputStream
Skips n bytes of input from this input stream.
skip(long). Method in class java.io.StringReader
Skip characters.

i.c
skip(long). Method in class java.util.zip.ZipInputStream
Skips specified number of bytes in the current ZIP entry.
skipBytes(int). Method in interface java.io.DataInput
Skips exactly n bytes of input.
skipBytes(int). Method in class java.io.DataInputStream
Skips exactly n bytes of input in the underlying input stream.
skipBytes(int). Method in class java.io.ObjectInputStream
Skips bytes, block until all bytes are skipped.
skipBytes(int). Method in class java.io.RandomAccessFile
Skips exactly n bytes of input.

dil
slashSlashComments(boolean). Method in class java.io.StreamTokenizer
Determines whether or not the tokenizer recognizes C++-style comments.
slashStarComments(boolean). Method in class java.io.StreamTokenizer
Determines whether or not the tokenizer recognizes C-style comments.
sleep(long). Static method in class java.lang.Thread
Causes the currently executing thread to sleep (temporarily cease execution) for the specified
number of milliseconds.
sleep(long, int). Static method in class java.lang.Thread
Causes the currently executing thread to sleep (cease execution) for the specified number of
milliseconds plus the specified number of nanoseconds.
SMALLINT. Static variable in class java.sql.Types
va
Socket(). Constructor for class java.net.Socket
Creates an unconnected socket, with the system-default type of SocketImpl.
Socket(InetAddress, int). Constructor for class java.net.Socket
Creates a stream socket and connects it to the specified port number at the specified IP
address.
Socket(InetAddress, int, boolean). Constructor for class java.net.Socket
Creates a socket and connects it to the specified port number at the specified IP address.
Socket(InetAddress, int, InetAddress, int). Constructor for class java.net.Socket
Creates a socket and connects it to the specified remote address on the specified remote port.
Socket(SocketImpl). Constructor for class java.net.Socket
ja

Creates an unconnected Socket with a user-specified SocketImpl.


Socket(String, int). Constructor for class java.net.Socket
Creates a stream socket and connects it to the specified port number on the named host.
Socket(String, int, boolean). Constructor for class java.net.Socket
Creates a stream socket and connects it to the specified port number on the named host.
Socket(String, int, InetAddress, int). Constructor for class java.net.Socket
Creates a socket and connects it to the specified remote host on the specified remote port.
w.

SocketException(). Constructor for class java.net.SocketException


Constructs a new ProtocolException with no detail message.
SocketException(String). Constructor for class java.net.SocketException
Constructs a new ProtocolException with the specified detail message.
SocketImpl(). Constructor for class java.net.SocketImpl
SocketSecurityException(String). Constructor for class java.rmi.server.SocketSecurityException
Create A remote exception with the specified string
SocketSecurityException(String, Exception). Constructor for class
java.rmi.server.SocketSecurityException
Create A remote exception with the specified string, and the exception specified.
ww

SOMEBITS. Static variable in interface java.awt.image.ImageObserver


More pixels needed for drawing a scaled variation of the image are available.
source. Variable in class java.util.EventObject
SOUTH. Static variable in class java.awt.BorderLayout
The south layout constraint.
SOUTH. Static variable in class java.awt.GridBagConstraints
SOUTHEAST. Static variable in class java.awt.GridBagConstraints
SOUTHWEST. Static variable in class java.awt.GridBagConstraints
SPACE_SEPARATOR. Static variable in class java.lang.Character
SQLException(). Constructor for class java.sql.SQLException
Construct an SQLException; reason defaults to null, SQLState defaults to null and vendorCode
defaults to 0.

414
415

SQLException(String). Constructor for class java.sql.SQLException


Construct an SQLException with a reason; SQLState defaults to null and vendorCode defaults to
0.

m
SQLException(String, String). Constructor for class java.sql.SQLException
Construct an SQLException with a reason and SQLState; vendorCode defaults to 0.
SQLException(String, String, int). Constructor for class java.sql.SQLException
Construct a fully-specified SQLException
SQLWarning(). Constructor for class java.sql.SQLWarning
Construct an SQLWarning ; reason defaults to null, SQLState defaults to null and vendorCode
defaults to 0.
SQLWarning(String). Constructor for class java.sql.SQLWarning

o
Construct an SQLWarning with a reason; SQLState defaults to null and vendorCode defaults to 0.
SQLWarning(String, String). Constructor for class java.sql.SQLWarning
Construct an SQLWarning with a reason and SQLState; vendorCode defaults to 0.
SQLWarning(String, String, int). Constructor for class java.sql.SQLWarning
Construct a fully specified SQLWarning.

i.c
sqrt(double). Static method in class java.lang.Math
Returns the square root of a double value.
srccols. Variable in class java.awt.image.ReplicateScaleFilter
srcHeight. Variable in class java.awt.image.ReplicateScaleFilter
srcrows. Variable in class java.awt.image.ReplicateScaleFilter
srcWidth. Variable in class java.awt.image.ReplicateScaleFilter
Stack(). Constructor for class java.util.Stack
StackFrame(). Constructor for class sun.tools.debug.StackFrame
StackOverflowError(). Constructor for class java.lang.StackOverflowError
Constructs a StackOverflowError with no detail message.

dil
StackOverflowError(String). Constructor for class java.lang.StackOverflowError
Constructs a StackOverflowError with the specified detail message.
start(). Method in class java.applet.Applet
Called by the browser or applet viewer to inform this applet that it should start its
execution.
start(). Method in class java.lang.Thread
Causes this thread to begin execution; the Java Virtual Machine calls the run method of this
thread.
START_PUNCTUATION. Static variable in class java.lang.Character
startGrabbing(). Method in class java.awt.image.PixelGrabber
Request the PixelGrabber to start fetching the pixels.
va
startProduction(ImageConsumer). Method in class java.awt.image.FilteredImageSource
Adds an ImageConsumer to the list of consumers interested in data for this image, and
immediately starts delivery of the image data through the ImageConsumer interface.
startProduction(ImageConsumer). Method in interface java.awt.image.ImageProducer
This method both registers the given ImageConsumer object as a consumer and starts an
immediate reconstruction of the image data which will then be delivered to this consumer and
any other consumer which may have already been registered with the producer.
startProduction(ImageConsumer). Method in class java.awt.image.MemoryImageSource
Adds an ImageConsumer to the list of consumers interested in data for this image, and
immediately start delivery of the image data through the ImageConsumer interface.
ja

startsWith(String). Method in class java.lang.String


Tests if this string starts with the specified prefix.
startsWith(String, int). Method in class java.lang.String
Tests if this string starts with the specified prefix.
state. Variable in class java.security.Signature
Current state of this signature object.
STATIC. Static variable in class java.lang.reflect.Modifier
w.

STATICIMAGEDONE. Static variable in interface java.awt.image.ImageConsumer


The image is complete and there are no more pixels or frames to be delivered.
status(). Method in class java.awt.image.PixelGrabber
DEPRECATED: Replaced by getStatus().
statusAll(boolean). Method in class java.awt.MediaTracker
Returns the boolean OR of the status of all of the media being tracked.
statusID(int, boolean). Method in class java.awt.MediaTracker
Returns the boolean OR of the status of all of the media with a given ID.
step(boolean). Method in class sun.tools.debug.RemoteThread
Continue execution of this thread to the next instruction or line.
ww

stop(). Method in class java.applet.Applet


Called by the browser or applet viewer to inform this applet that it should stop its
execution.
stop(). Method in interface java.applet.AudioClip
Stops playing this audio clip.
stop(). Method in class sun.tools.debug.RemoteThread
Stop the remote thread.
stop(). Method in class sun.tools.debug.RemoteThreadGroup
Stop the remote threadgroup.
stop(). Method in class java.lang.Thread
Forces the thread to stop executing.
stop(). Method in class java.lang.ThreadGroup

415
416

Stops all processes in this thread group.


stop(Throwable). Method in class java.lang.Thread
Forces the thread to stop executing.

m
STORED. Static variable in class java.util.zip.ZipEntry
Compression method for uncompressed entries.
STORED. Static variable in class java.util.zip.ZipOutputStream
Compression method for uncompressed (STORED) entries.
storesLowerCaseIdentifiers(). Method in interface java.sql.DatabaseMetaData
Does the database treat mixed case unquoted SQL identifiers as case insensitive and store them
in lower case?
storesLowerCaseQuotedIdentifiers(). Method in interface java.sql.DatabaseMetaData

o
Does the database treat mixed case quoted SQL identifiers as case insensitive and store them
in lower case?
storesMixedCaseIdentifiers(). Method in interface java.sql.DatabaseMetaData
Does the database treat mixed case unquoted SQL identifiers as case insensitive and store them
in mixed case?

i.c
storesMixedCaseQuotedIdentifiers(). Method in interface java.sql.DatabaseMetaData
Does the database treat mixed case quoted SQL identifiers as case insensitive and store them
in mixed case?
storesUpperCaseIdentifiers(). Method in interface java.sql.DatabaseMetaData
Does the database treat mixed case unquoted SQL identifiers as case insensitive and store them
in upper case?
storesUpperCaseQuotedIdentifiers(). Method in interface java.sql.DatabaseMetaData
Does the database treat mixed case quoted SQL identifiers as case insensitive and store them
in upper case?
StreamCorruptedException(). Constructor for class java.io.StreamCorruptedException

dil
Create a StreamCorruptedException with no reason.
StreamCorruptedException(String). Constructor for class java.io.StreamCorruptedException
Create a StreamCorruptedException with a reason.
StreamTokenizer(InputStream). Constructor for class java.io.StreamTokenizer
Creates a stream tokenizer that parses the specified input stream.
StreamTokenizer(Reader). Constructor for class java.io.StreamTokenizer
Create a tokenizer that parses the given character stream.
String(). Constructor for class java.lang.String
Allocates a new String containing no characters.
String(byte[]). Constructor for class java.lang.String
Construct a new String by converting the specified array of bytes using the platform's default
va
character encoding.
String(byte[], int). Constructor for class java.lang.String
Allocates a new String containing characters constructed from an array of 8-bit integer
values.
String(byte[], int, int). Constructor for class java.lang.String
Construct a new String by converting the specified subarray of bytes using the platform's
default character encoding.
String(byte[], int, int, int). Constructor for class java.lang.String
Allocates a new String constructed from a subarray of an array of 8-bit integer values.
String(byte[], int, int, String). Constructor for class java.lang.String
ja

Construct a new String by converting the specified subarray of bytes using the specified
character encoding.
String(byte[], String). Constructor for class java.lang.String
Construct a new String by converting the specified array of bytes using the specified
character encoding.
String(char[]). Constructor for class java.lang.String
Allocates a new String so that it represents the sequence of characters currently contained in
w.

the character array argument.


String(char[], int, int). Constructor for class java.lang.String
Allocates a new String that contains characters from a subarray of the character array
argument.
String(String). Constructor for class java.lang.String
Allocates a new string that contains the same sequence of characters as the string argument.
String(StringBuffer). Constructor for class java.lang.String
Allocates a new string that contains the sequence of characters currently contained in the
string buffer argument.
StringBuffer(). Constructor for class java.lang.StringBuffer
ww

Constructs a string buffer with no characters in it and an initial capacity of 16 characters.


StringBuffer(int). Constructor for class java.lang.StringBuffer
Constructs a string buffer with no characters in it and an initial capacity specified by the
length argument.
StringBuffer(String). Constructor for class java.lang.StringBuffer
Constructs a string buffer so that it represents the same sequence of characters as the string
argument.
StringBufferInputStream(String). Constructor for class java.io.StringBufferInputStream
Creates a string input stream to read data from the specified string.
StringCharacterIterator(String). Constructor for class java.text.StringCharacterIterator
Construct an iterator with an initial index of 0.
StringCharacterIterator(String, int). Constructor for class java.text.StringCharacterIterator

416
417

Construct an iterator with the specified initial index.


StringCharacterIterator(String, int, int, int). Constructor for class
java.text.StringCharacterIterator

m
Construct an iterator over the given range of the given string, with the index set at the
specified position.
stringFlavor. Static variable in class java.awt.datatransfer.DataFlavor
The DataFlavor representing a Java Unicode String class, where:

representationClass = java.lang.String
mimeType = "application/x-javaserializedobject"

o
StringIndexOutOfBoundsException(). Constructor for class java.lang.StringIndexOutOfBoundsException
Constructs a StringIndexOutOfBoundsException with no detail message.
StringIndexOutOfBoundsException(int). Constructor for class
java.lang.StringIndexOutOfBoundsException
Constructs a new StringIndexOutOfBoundsException class with an argument indicating the illegal

i.c
index.
StringIndexOutOfBoundsException(String). Constructor for class
java.lang.StringIndexOutOfBoundsException
Constructs a StringIndexOutOfBoundsException with the specified detail message.
StringReader(String). Constructor for class java.io.StringReader
Create a new string reader.
StringSelection(String). Constructor for class java.awt.datatransfer.StringSelection
Creates a transferable object capable of transferring the specified string in plain text
format.
StringTokenizer(String). Constructor for class java.util.StringTokenizer

dil
Constructs a string tokenizer for the specified string.
StringTokenizer(String, String). Constructor for class java.util.StringTokenizer
Constructs a string tokenizer for the specified string.
StringTokenizer(String, String, boolean). Constructor for class java.util.StringTokenizer
Constructs a string tokenizer for the specified string.
stringWidth(String). Method in class java.awt.FontMetrics
Returns the total advance width for showing the specified String in this Font.
StringWriter(). Constructor for class java.io.StringWriter
Create a new string writer, using the default initial string-buffer size.
StringWriter(int). Constructor for class java.io.StringWriter
Create a new string writer, using the specified initial string-buffer size.
va
StubNotFoundException(String). Constructor for class java.rmi.StubNotFoundException
Create a new StubNotFoundException with a descriptive string.
StubNotFoundException(String, Exception). Constructor for class java.rmi.StubNotFoundException
Create a new StubNotFoundException with a descriptive string and an exception.
style. Variable in class java.awt.Font
The style of the font.
substituteColorModel(ColorModel, ColorModel). Method in class java.awt.image.RGBImageFilter
Registers two ColorModel objects for substitution.
substring(int). Method in class java.lang.String
Returns a new string that is a substring of this string.
ja

substring(int, int). Method in class java.lang.String


Returns a new string that is a substring of this string.
subtract(BigDecimal). Method in class java.math.BigDecimal
Returns a BigDecimal whose value is (this - val), and whose scale is MAX(this.scale(),
val.scale).
subtract(BigInteger). Method in class java.math.BigInteger
Returns a BigInteger whose value is (this - val).
w.

SUNDAY. Static variable in class java.util.Calendar


Useful constant for days of week.
supportsAlterTableWithAddColumn(). Method in interface java.sql.DatabaseMetaData
Is "ALTER TABLE" with add column supported?
supportsAlterTableWithDropColumn(). Method in interface java.sql.DatabaseMetaData
Is "ALTER TABLE" with drop column supported?
supportsANSI92EntryLevelSQL(). Method in interface java.sql.DatabaseMetaData
Is the ANSI92 entry level SQL grammar supported? All JDBC-Compliant drivers must return true.
supportsANSI92FullSQL(). Method in interface java.sql.DatabaseMetaData
Is the ANSI92 full SQL grammar supported?
ww

supportsANSI92IntermediateSQL(). Method in interface java.sql.DatabaseMetaData


Is the ANSI92 intermediate SQL grammar supported?
supportsCatalogsInDataManipulation(). Method in interface java.sql.DatabaseMetaData
Can a catalog name be used in a data manipulation statement?
supportsCatalogsInIndexDefinitions(). Method in interface java.sql.DatabaseMetaData
Can a catalog name be used in an index definition statement?
supportsCatalogsInPrivilegeDefinitions(). Method in interface java.sql.DatabaseMetaData
Can a catalog name be used in a privilege definition statement?
supportsCatalogsInProcedureCalls(). Method in interface java.sql.DatabaseMetaData
Can a catalog name be used in a procedure call statement?
supportsCatalogsInTableDefinitions(). Method in interface java.sql.DatabaseMetaData
Can a catalog name be used in a table definition statement?

417
418

supportsColumnAliasing(). Method in interface java.sql.DatabaseMetaData


Is column aliasing supported?

m
If so, the SQL AS clause can be used to provide names for computed columns or to provide alias
names for columns as required.
supportsConvert(). Method in interface java.sql.DatabaseMetaData
Is the CONVERT function between SQL types supported?
supportsConvert(int, int). Method in interface java.sql.DatabaseMetaData
Is CONVERT between the given SQL types supported?
supportsCoreSQLGrammar(). Method in interface java.sql.DatabaseMetaData
Is the ODBC Core SQL grammar supported?

o
supportsCorrelatedSubqueries(). Method in interface java.sql.DatabaseMetaData
Are correlated subqueries supported? A JDBC-Compliant driver always returns true.
supportsCustomEditor(). Method in interface java.beans.PropertyEditor
supportsCustomEditor(). Method in class java.beans.PropertyEditorSupport
supportsDataDefinitionAndDataManipulationTransactions(). Method in interface

i.c
java.sql.DatabaseMetaData
Are both data definition and data manipulation statements within a transaction supported?
supportsDataManipulationTransactionsOnly(). Method in interface java.sql.DatabaseMetaData
Are only data manipulation statements within a transaction supported?
supportsDifferentTableCorrelationNames(). Method in interface java.sql.DatabaseMetaData
If table correlation names are supported, are they restricted to be different from the names
of the tables?
supportsExpressionsInOrderBy(). Method in interface java.sql.DatabaseMetaData
Are expressions in "ORDER BY" lists supported?
supportsExtendedSQLGrammar(). Method in interface java.sql.DatabaseMetaData

dil
Is the ODBC Extended SQL grammar supported?
supportsFullOuterJoins(). Method in interface java.sql.DatabaseMetaData
Are full nested outer joins supported?
supportsGroupBy(). Method in interface java.sql.DatabaseMetaData
Is some form of "GROUP BY" clause supported?
supportsGroupByBeyondSelect(). Method in interface java.sql.DatabaseMetaData
Can a "GROUP BY" clause add columns not in the SELECT provided it specifies all the columns in
the SELECT?
supportsGroupByUnrelated(). Method in interface java.sql.DatabaseMetaData
Can a "GROUP BY" clause use columns not in the SELECT?
supportsIntegrityEnhancementFacility(). Method in interface java.sql.DatabaseMetaData
va
Is the SQL Integrity Enhancement Facility supported?
supportsLikeEscapeClause(). Method in interface java.sql.DatabaseMetaData
Is the escape character in "LIKE" clauses supported? A JDBC-Compliant driver always returns
true.
supportsLimitedOuterJoins(). Method in interface java.sql.DatabaseMetaData
Is there limited support for outer joins? (This will be true if supportFullOuterJoins is
true.)
supportsMinimumSQLGrammar(). Method in interface java.sql.DatabaseMetaData
Is the ODBC Minimum SQL grammar supported? All JDBC-Compliant drivers must return true.
supportsMixedCaseIdentifiers(). Method in interface java.sql.DatabaseMetaData
ja

Does the database treat mixed case unquoted SQL identifiers as case sensitive and as a result
store them in mixed case? A JDBC-Compliant driver will always return false.
supportsMixedCaseQuotedIdentifiers(). Method in interface java.sql.DatabaseMetaData
Does the database treat mixed case quoted SQL identifiers as case sensitive and as a result
store them in mixed case? A JDBC-Compliant driver will always return true.
supportsMultipleResultSets(). Method in interface java.sql.DatabaseMetaData
Are multiple ResultSets from a single execute supported?
w.

supportsMultipleTransactions(). Method in interface java.sql.DatabaseMetaData


Can we have multiple transactions open at once (on different connections)?
supportsNonNullableColumns(). Method in interface java.sql.DatabaseMetaData
Can columns be defined as non-nullable? A JDBC-Compliant driver always returns true.
supportsOpenCursorsAcrossCommit(). Method in interface java.sql.DatabaseMetaData
Can cursors remain open across commits?
supportsOpenCursorsAcrossRollback(). Method in interface java.sql.DatabaseMetaData
Can cursors remain open across rollbacks?
supportsOpenStatementsAcrossCommit(). Method in interface java.sql.DatabaseMetaData
Can statements remain open across commits?
ww

supportsOpenStatementsAcrossRollback(). Method in interface java.sql.DatabaseMetaData


Can statements remain open across rollbacks?
supportsOrderByUnrelated(). Method in interface java.sql.DatabaseMetaData
Can an "ORDER BY" clause use columns not in the SELECT?
supportsOuterJoins(). Method in interface java.sql.DatabaseMetaData
Is some form of outer join supported?
supportsPositionedDelete(). Method in interface java.sql.DatabaseMetaData
Is positioned DELETE supported?
supportsPositionedUpdate(). Method in interface java.sql.DatabaseMetaData
Is positioned UPDATE supported?
supportsSchemasInDataManipulation(). Method in interface java.sql.DatabaseMetaData
Can a schema name be used in a data manipulation statement?

418
419

supportsSchemasInIndexDefinitions(). Method in interface java.sql.DatabaseMetaData


Can a schema name be used in an index definition statement?
supportsSchemasInPrivilegeDefinitions(). Method in interface java.sql.DatabaseMetaData

m
Can a schema name be used in a privilege definition statement?
supportsSchemasInProcedureCalls(). Method in interface java.sql.DatabaseMetaData
Can a schema name be used in a procedure call statement?
supportsSchemasInTableDefinitions(). Method in interface java.sql.DatabaseMetaData
Can a schema name be used in a table definition statement?
supportsSelectForUpdate(). Method in interface java.sql.DatabaseMetaData
Is SELECT for UPDATE supported?
supportsStoredProcedures(). Method in interface java.sql.DatabaseMetaData

o
Are stored procedure calls using the stored procedure escape syntax supported?
supportsSubqueriesInComparisons(). Method in interface java.sql.DatabaseMetaData
Are subqueries in comparison expressions supported? A JDBC-Compliant driver always returns
true.
supportsSubqueriesInExists(). Method in interface java.sql.DatabaseMetaData

i.c
Are subqueries in 'exists' expressions supported? A JDBC-Compliant driver always returns true.
supportsSubqueriesInIns(). Method in interface java.sql.DatabaseMetaData
Are subqueries in 'in' statements supported? A JDBC-Compliant driver always returns true.
supportsSubqueriesInQuantifieds(). Method in interface java.sql.DatabaseMetaData
Are subqueries in quantified expressions supported? A JDBC-Compliant driver always returns
true.
supportsTableCorrelationNames(). Method in interface java.sql.DatabaseMetaData
Are table correlation names supported? A JDBC-Compliant driver always returns true.
supportsTransactionIsolationLevel(int). Method in interface java.sql.DatabaseMetaData
Does the database support the given transaction isolation level?

dil
supportsTransactions(). Method in interface java.sql.DatabaseMetaData
Are transactions supported? If not, commit is a noop and the isolation level is
TRANSACTION_NONE.
supportsUnion(). Method in interface java.sql.DatabaseMetaData
Is SQL UNION supported?
supportsUnionAll(). Method in interface java.sql.DatabaseMetaData
Is SQL UNION ALL supported?
SURROGATE. Static variable in class java.lang.Character
suspend(). Method in class sun.tools.debug.RemoteThread
Suspend execution of this thread.
suspend(). Method in class java.lang.Thread
va
Suspends this thread.
suspend(). Method in class java.lang.ThreadGroup
Suspends all processes in this thread group.
sval. Variable in class java.io.StreamTokenizer
If the current token is a word token, this field contains a string giving the characters of
the word token.
SW_RESIZE_CURSOR. Static variable in class java.awt.Cursor
The south-west-resize cursor type.
SW_RESIZE_CURSOR. Static variable in class java.awt.Frame
sync(). Method in class java.io.FileDescriptor
ja

Force all system buffers to synchronize with the underlying device.


sync(). Method in class java.awt.Toolkit
Syncs the graphics state; useful when doing animation.
SyncFailedException(String). Constructor for class java.io.SyncFailedException
Constructs an SyncFailedException with a detail message.
SYNCHRONIZED. Static variable in class java.lang.reflect.Modifier
w.

TAB. Static variable in class java.awt.Event


The Tab key.
tableIndexClustered. Static variable in interface java.sql.DatabaseMetaData
INDEX INFO TYPE - this identifies a clustered index
tableIndexHashed. Static variable in interface java.sql.DatabaseMetaData
INDEX INFO TYPE - this identifies a hashed index
ww

tableIndexOther. Static variable in interface java.sql.DatabaseMetaData


INDEX INFO TYPE - this identifies some other form of index
tableIndexStatistic. Static variable in interface java.sql.DatabaseMetaData
INDEX INFO TYPE - this identifies table statistics that are returned in conjuction with a
table's index descriptions
TAIWAN. Static variable in class java.util.Locale
Useful constant for country.
tan(double). Static method in class java.lang.Math
Returns the trigonometric tangent of an angle.
target. Variable in class java.awt.Event
The target component.
TERTIARY. Static variable in class java.text.Collator

419
420

Collator strength value.


tertiaryOrder(int). Static method in class java.text.CollationElementIterator
Get the tertiary order of a collation order.

m
testBit(int). Method in class java.math.BigInteger
Returns true iff the designated bit is set.
text. Static variable in class java.awt.SystemColor
The background color for text components.
TEXT. Static variable in class java.awt.SystemColor
The array index for the text background color.
TEXT_CURSOR. Static variable in class java.awt.Cursor
The text cursor type.

o
TEXT_CURSOR. Static variable in class java.awt.Frame
TEXT_EVENT_MASK. Static variable in class java.awt.AWTEvent
The event mask for selecting text events.
TEXT_FIRST. Static variable in class java.awt.event.TextEvent
Marks the first integer id for the range of adjustment event ids.

i.c
TEXT_HIGHLIGHT. Static variable in class java.awt.SystemColor
The array index for the text highlight color.
TEXT_HIGHLIGHT_TEXT. Static variable in class java.awt.SystemColor
The array index for the text highlight text color.
TEXT_INACTIVE_TEXT. Static variable in class java.awt.SystemColor
The array index for the text inactive text color.
TEXT_LAST. Static variable in class java.awt.event.TextEvent
Marks the last integer id for the range of adjustment event ids.
TEXT_TEXT. Static variable in class java.awt.SystemColor
The array index for the text text color.

dil
TEXT_VALUE_CHANGED. Static variable in class java.awt.event.TextEvent
The adjustment value changed event.
TextArea(). Constructor for class java.awt.TextArea
Constructs a new TextArea.
TextArea(int, int). Constructor for class java.awt.TextArea
Constructs a new empty TextArea with the specified number of rows and columns.
TextArea(String). Constructor for class java.awt.TextArea
Constructs a new TextArea with the specified text displayed.
TextArea(String, int, int). Constructor for class java.awt.TextArea
Constructs a new TextArea with the specified text and number of rows and columns.
TextArea(String, int, int, int). Constructor for class java.awt.TextArea
va
Constructs a new TextArea with the specified text and number of rows, columns, and scrollbar
visibility.
TextEvent(Object, int). Constructor for class java.awt.event.TextEvent
Constructs a TextEvent object with the specified TextComponent source, and type.
TextField(). Constructor for class java.awt.TextField
Constructs a new TextField.
TextField(int). Constructor for class java.awt.TextField
Constructs a new empty TextField with the specified number of columns.
TextField(String). Constructor for class java.awt.TextField
Constructs a new TextField initialized with the specified text.
ja

TextField(String, int). Constructor for class java.awt.TextField


Constructs a new TextField initialized with the specified text and columns.
textHighlight. Static variable in class java.awt.SystemColor
The background color for highlighted text.
textHighlightText. Static variable in class java.awt.SystemColor
The text color for highlighted text.
textInactiveText. Static variable in class java.awt.SystemColor
w.

The text color for inactive text.


textListener. Variable in class java.awt.TextComponent
textText. Static variable in class java.awt.SystemColor
The text color for text components.
textValueChanged(TextEvent). Method in class java.awt.AWTEventMulticaster
textValueChanged(TextEvent). Method in interface java.awt.event.TextListener
Invoked when the value of the text has changed.
Thread(). Constructor for class java.lang.Thread
Allocates a new Thread object.
Thread(Runnable). Constructor for class java.lang.Thread
ww

Allocates a new Thread object.


Thread(Runnable, String). Constructor for class java.lang.Thread
Allocates a new Thread object.
Thread(String). Constructor for class java.lang.Thread
Allocates a new Thread object.
Thread(ThreadGroup, Runnable). Constructor for class java.lang.Thread
Allocates a new Thread object.
Thread(ThreadGroup, Runnable, String). Constructor for class java.lang.Thread
Allocates a new Thread object so that it has target as its run object, has the specified name
as its name, and belongs to the thread group referred to by group.
Thread(ThreadGroup, String). Constructor for class java.lang.Thread
Allocates a new Thread object.

420
421

ThreadDeath(). Constructor for class java.lang.ThreadDeath


threadDeathEvent(RemoteThread). Method in interface sun.tools.debug.DebuggerCallback
A thread has died.

m
ThreadGroup(String). Constructor for class java.lang.ThreadGroup
Constructs a new thread group.
ThreadGroup(ThreadGroup, String). Constructor for class java.lang.ThreadGroup
Creates a new thread group.
Throwable(). Constructor for class java.lang.Throwable
Constructs a new Throwable with no detail message.
Throwable(String). Constructor for class java.lang.Throwable
Constructs a new Throwable with the specified detail message.

o
THURSDAY. Static variable in class java.util.Calendar
Useful constant for days of week.
time. Variable in class java.util.Calendar
The current time set for the calendar.
TIME. Static variable in class java.sql.Types

i.c
Time(int, int, int). Constructor for class java.sql.Time
Construct a Time Object
Time(long). Constructor for class java.sql.Time
Construct a Time using a milliseconds time value
TIMESTAMP. Static variable in class java.sql.Types
Timestamp(int, int, int, int, int, int, int). Constructor for class java.sql.Timestamp
Construct a Timestamp Object
Timestamp(long). Constructor for class java.sql.Timestamp
Construct a Timestamp using a milliseconds time value.
TimeZone(). Constructor for class java.util.TimeZone

dil
TIMEZONE_FIELD. Static variable in class java.text.DateFormat
Useful constant for TIMEZONE field alignment.
TINYINT. Static variable in class java.sql.Types
TITLECASE_LETTER. Static variable in class java.lang.Character
toBack(). Method in class java.awt.Window
Places this window at the bottom of the stacking order and makes the corresponding adjustment
to other visible windows.
toBack(). Method in interface java.awt.peer.WindowPeer
toBigInteger(). Method in class java.math.BigDecimal
Converts this number to a BigInteger.
toBinaryString(int). Static method in class java.lang.Integer
va
Creates a string representation of the integer argument as an unsigned integer in base 2.
toBinaryString(long). Static method in class java.lang.Long
Creates a string representation of the long argument as an unsigned integer in base 2.
toByteArray(). Method in class java.math.BigInteger
Returns the two's-complement representation of this number.
toByteArray(). Method in class java.io.ByteArrayOutputStream
Creates a newly allocated byte array.
toByteArray(). Method in class java.text.CollationKey
Converts the CollationKey to a sequence of bits.
toCharArray(). Method in class java.io.CharArrayWriter
ja

Returns a copy of the input data.


toCharArray(). Method in class java.lang.String
Converts this string to a new character array.
toExternalForm(). Method in class java.net.URL
Constructs a string representation of this URL.
toExternalForm(URL). Method in class java.net.URLStreamHandler
Converts a URL of a specific protocol to a String.
w.

toFront(). Method in class java.awt.Window


Places this window at the top of the stacking order and shows it in front of any other
windows.
toFront(). Method in interface java.awt.peer.WindowPeer
toGMTString(). Method in class java.util.Date
Creates a string representation of this date.
toHex(int). Static method in class sun.tools.debug.RemoteValue
Convert an int to a hexadecimal string.
toHexString(int). Static method in class java.lang.Integer
Creates a string representation of the integer argument as an unsigned integer in base 16.
ww

toHexString(long). Static method in class java.lang.Long


Creates a string representation of the long argument as an unsigned integer in base 16.
toLocaleString(). Method in class java.util.Date
Creates a string representation of this date in an implementation-dependent form.
toLocalizedPattern(). Method in class java.text.DecimalFormat
Synthesizes a localized pattern string that represents the current state of this Format
object.
toLocalizedPattern(). Method in class java.text.SimpleDateFormat
Return a localized pattern string describing this date format.
toLowerCase(). Method in class java.lang.String
Converts this string to lowercase.
toLowerCase(char). Static method in class java.lang.Character

421
422

The given character is mapped to its lowercase equivalent; if the character has no lowercase
equivalent, the character itself is returned.
toLowerCase(Locale). Method in class java.lang.String

m
Converts all of the characters in this String to lower case using the rules of the given
locale.
toOctalString(int). Static method in class java.lang.Integer
Creates a string representation of the integer argument as an unsigned integer in base 8.
toOctalString(long). Static method in class java.lang.Long
Creates a string representation of the long argument as an unsigned integer in base 8.
Toolkit(). Constructor for class java.awt.Toolkit
TooManyListenersException(). Constructor for class java.util.TooManyListenersException

o
Constructs a TooManyListenersException with no detail message.
TooManyListenersException(String). Constructor for class java.util.TooManyListenersException
Constructs a TooManyListenersException with the specified detail message.
top. Variable in class java.awt.Insets
The inset from the top.

i.c
TOP_ALIGNMENT. Static variable in class java.awt.Component
Ease of use constant for getAlignmentY().
toPattern(). Method in class java.text.ChoiceFormat
Gets the pattern.
toPattern(). Method in class java.text.DecimalFormat
Synthesizes a pattern string that represents the current state of this Format object.
toPattern(). Method in class java.text.MessageFormat
Gets the pattern.
toPattern(). Method in class java.text.SimpleDateFormat
Return a pattern string describing this date format.

dil
TOPDOWNLEFTRIGHT. Static variable in interface java.awt.image.ImageConsumer
The pixels will be delivered in top-down, left-to-right order.
toString(). Method in interface java.security.acl.Acl
Returns a string representation of the ACL contents.
toString(). Method in interface java.security.acl.AclEntry
Returns a string representation of the contents of this ACL entry.
toString(). Method in class java.awt.AWTEvent
Returns a string representation of the object.
toString(). Method in class java.math.BigDecimal
Returns the string representation of this number.
toString(). Method in class java.math.BigInteger
va
Returns the string representation of this number, radix 10.
toString(). Method in class java.util.BitSet
Returns a string representation of this bit set.
toString(). Method in class java.lang.Boolean
Returns a String object representing this Boolean's value.
toString(). Method in class java.awt.BorderLayout
Returns the String representation of this BorderLayout's values.
toString(). Method in class java.lang.Byte
Returns a String object representing this Byte's value.
toString(). Method in class java.io.ByteArrayOutputStream
ja

Creates a newly allocated string.


toString(). Method in class java.awt.CardLayout
Returns the String representation of this CardLayout's values.
toString(). Method in class java.lang.Character
Returns a String object representing this character's value.
toString(). Method in class java.io.CharArrayWriter
Converts input data to a string.
w.

toString(). Method in class java.awt.CheckboxGroup


Returns the String representation of this CheckboxGroup's values.
toString(). Method in class java.lang.Class
Converts the object to a string.
toString(). Method in class java.awt.Color
Returns the String representation of this Color's values.
toString(). Method in class java.awt.Component
Returns the String representation of this Component's values.
toString(). Method in class java.lang.reflect.Constructor
Return a string describing this Constructor.
ww

toString(). Method in class java.sql.Date


Format a date in JDBC date escape format
toString(). Method in class java.util.Date
Returns a canonical string representation of the date.
toString(). Method in class java.security.DigestInputStream
Prints a string representation of this digest input stream and its associated message digest
object.
toString(). Method in class java.security.DigestOutputStream
Prints a string representation of this digest output stream and its associated message digest
object.
toString(). Method in class java.awt.Dimension
Returns the String representation of this Dimension's values.

422
423

toString(). Method in class java.lang.Double


Returns a String representation of this Double object.
toString(). Method in class java.awt.Event

m
Returns the String representation of this Event's values.
toString(). Method in class java.util.EventObject
Returns a string representation of the object.
toString(). Method in class java.lang.reflect.Field
Return a string describing this Field.
toString(). Method in class java.io.File
Returns a string representation of this object.
toString(). Method in class java.lang.Float

o
Returns a String representation of this Float object.
toString(). Method in class java.awt.FlowLayout
Returns the String representation of this FlowLayout's values.
toString(). Method in class java.awt.Font
Converts this object to a String representation.

i.c
toString(). Method in class java.awt.FontMetrics
Returns the String representation of this FontMetric's values.
toString(). Method in class java.awt.Graphics
Returns a String object representing this Graphics object's value.
toString(). Method in class java.awt.GridBagLayout
Returns the String representation of this GridLayout's values.
toString(). Method in class java.awt.GridLayout
Returns the String representation of this GridLayout's values.
toString(). Method in class java.util.Hashtable
Returns a rather long string representation of this hashtable.

dil
toString(). Method in class java.security.Identity
Returns a short string describing this identity, telling its name and its scope (if any).
toString(). Method in class java.security.IdentityScope
Returns a string representation of this identity scope, including its name, its scope name,
and the number of identities in this identity scope.
toString(). Method in class java.net.InetAddress
Converts this IP address to a String.
toString(). Method in class java.awt.Insets
Returns a String object representing this Inset's values.
toString(). Method in class java.lang.Integer
Returns a String object representing this Integer's value.
va
toString(). Method in class java.util.Locale
Getter for the programmatic name of the entire locale, with the language, country and variant
separated by underbars.
toString(). Method in class java.rmi.server.LogStream
Return log name as string representation
toString(). Method in class java.lang.Long
Returns a String object representing this Long's value.
toString(). Method in class java.awt.MenuComponent
Returns the String representation of this MenuComponent's values.
toString(). Method in class java.awt.MenuShortcut
ja

Returns an internationalized description of the MenuShortcut.


toString(). Method in class java.security.MessageDigest
Returns a string representation of this message digest object.
toString(). Method in class java.lang.reflect.Method
Returns a string describing this Method.
toString(). Method in class java.lang.Object
Returns a string representation of the object.
w.

toString(). Method in class java.io.ObjectStreamClass


Return a string describing this ObjectStreamClass.
toString(). Method in class java.rmi.server.ObjID
Returns a string containing the object id representation.
toString(). Method in class java.rmi.server.Operation
Returns a string representation of the object.
toString(). Method in interface java.security.acl.Permission
Prints a string representation of this permission.
toString(). Method in class java.awt.Point
Returns the String representation of this Point's coordinates.
ww

toString(). Method in interface java.security.Principal


Returns a string representation of this principal.
toString(). Method in class java.security.Provider
Returns a string with the name and the version number of this provider.
toString(). Method in class java.awt.Rectangle
Returns the String representation of this Rectangle's values.
toString(). Method in class sun.tools.debug.RemoteArray
Return a string version of the array.
toString(). Method in class sun.tools.debug.RemoteBoolean
Return the boolean's value as a string.
toString(). Method in class sun.tools.debug.RemoteByte
Return the byte's value as a string.

423
424

toString(). Method in class sun.tools.debug.RemoteChar


Return the char's value as a string.
toString(). Method in class sun.tools.debug.RemoteClass

m
Return a (somewhat verbose) description.
toString(). Method in class sun.tools.debug.RemoteDouble
Return the double's value as a string.
toString(). Method in class sun.tools.debug.RemoteField
Returns a string representation of the object.
toString(). Method in class sun.tools.debug.RemoteFloat
Return the float's value as a string.
toString(). Method in class sun.tools.debug.RemoteInt

o
Return the int's value as a string.
toString(). Method in class sun.tools.debug.RemoteLong
Return the long's value as a string.
toString(). Method in class java.rmi.server.RemoteObject
Returns a String that represents the value of this remote object.

i.c
toString(). Method in class sun.tools.debug.RemoteObject
Return object as a string.
toString(). Method in class sun.tools.debug.RemoteShort
Return the short's value as a string.
toString(). Method in class sun.tools.debug.RemoteString
Return the string value, or "null"
toString(). Method in class java.net.ServerSocket
Returns the implementation address and implementation port of this socket as a String.
toString(). Method in class java.lang.Short
Returns a String object representing this Short's value.

dil
toString(). Method in class java.security.Signature
Returns a string representation of this signature object, providing information that includes
the state of the object and the name of the algorithm used.
toString(). Method in class java.security.Signer
Returns a string of information about the signer.
toString(). Method in class java.net.Socket
Converts this socket to a String.
toString(). Method in class java.net.SocketImpl
Returns the address and port of this socket as a String.
toString(). Method in class sun.tools.debug.StackFrame
Returns a string representation of the object.
va
toString(). Method in class java.io.StreamTokenizer
Returns the string representation of the current stream token.
toString(). Method in class java.lang.String
This object (which is already a string!) is itself returned.
toString(). Method in class java.lang.StringBuffer
Converts to a string representing the data in this string buffer.
toString(). Method in class java.io.StringWriter
Return the buffer's current value as a string.
toString(). Method in class java.awt.SystemColor
Returns the String representation of this Color's values.
ja

toString(). Method in class java.lang.Thread


Returns a string representation of this thread, including the thread's name, priority, and
thread group.
toString(). Method in class java.lang.ThreadGroup
Returns a string representation of this Thread group.
toString(). Method in class java.lang.Throwable
Returns a short description of this throwable object.
w.

toString(). Method in class java.sql.Time


Format a time in JDBC date escape format
toString(). Method in class java.sql.Timestamp
Format a timestamp in JDBC timestamp escape format
toString(). Method in class java.rmi.server.UID
Returns a string representation of the object.
toString(). Method in class java.net.URL
Constructs a string representation of this URL.
toString(). Method in class java.net.URLConnection
Returns a String representation of this URL connection.
ww

toString(). Method in class java.util.Vector


Returns a string representation of this vector.
toString(). Method in class java.rmi.dgc.VMID
Return string representation of this VMID.
toString(). Method in class java.util.zip.ZipEntry
Returns a string representation of the ZIP entry.
toString(boolean). Method in interface java.security.Certificate
Returns a string that represents the contents of the certificate.
toString(boolean). Method in class java.security.Identity
Returns a string representation of this identity, with optionally more details than that
provided by the toString method without any arguments.
toString(byte). Static method in class java.lang.Byte

424
425

Returns a new String object representing the specified Byte.


toString(double). Static method in class java.lang.Double
Creates a string representation of the double argument.

m
toString(float). Static method in class java.lang.Float
Returns a String representation for the specified float value.
toString(int). Method in class java.math.BigInteger
Returns the string representation of this number in the given radix.
toString(int). Method in class java.io.ByteArrayOutputStream
Creates a newly allocated string.
toString(int). Static method in class java.lang.Integer
Returns a new String object representing the specified integer.

o
toString(int). Static method in class java.lang.reflect.Modifier
Return a string describing the access modifier flags in the specified modifier.
toString(int, int). Static method in class java.lang.Integer
Creates a string representation of the first argument in the radix specified by the second
argument.

i.c
toString(long). Static method in class java.lang.Long
Returns a new String object representing the specified integer.
toString(long, int). Static method in class java.lang.Long
Creates a string representation of the first argument in the radix specified by the second
argument.
toString(short). Static method in class java.lang.Short
Returns a new String object representing the specified Short.
toString(String). Method in class java.io.ByteArrayOutputStream
Converts input data to a string, using the specified character encoding.
totalMemory(). Method in class sun.tools.debug.RemoteDebugger

dil
Report the total memory usage of the Java interpreter being debugged.
totalMemory(). Method in class java.lang.Runtime
Returns the total amount of memory in the Java Virtual Machine.
toTitleCase(char). Static method in class java.lang.Character
Converts the character argument to titlecase.
toUpperCase(). Method in class java.lang.String
Converts this string to uppercase.
toUpperCase(char). Static method in class java.lang.Character
Converts the character argument to uppercase.
toUpperCase(Locale). Method in class java.lang.String
Converts all of the characters in this String to upper case using the rules of the given
va
locale.
trace(boolean). Method in class sun.tools.debug.RemoteDebugger
Turn on/off method call tracing.
traceInstructions(boolean). Method in class java.lang.Runtime
Enables/Disables tracing of instructions.
traceMethodCalls(boolean). Method in class java.lang.Runtime
Enables/Disables tracing of method calls.
TRACK. Static variable in class java.awt.event.AdjustmentEvent
The absolute tracking adjustment type.
TRADITIONAL_CHINESE. Static variable in class java.util.Locale
ja

Useful constant for language.


TRANSACTION_NONE. Static variable in interface java.sql.Connection
Transactions are not supported.
TRANSACTION_READ_COMMITTED. Static variable in interface java.sql.Connection
Dirty reads are prevented; non-repeatable reads and phantom reads can occur.
TRANSACTION_READ_UNCOMMITTED. Static variable in interface java.sql.Connection
Dirty reads, non-repeatable reads and phantom reads can occur.
w.

TRANSACTION_REPEATABLE_READ. Static variable in interface java.sql.Connection


Dirty reads and non-repeatable reads are prevented; phantom reads can occur.
TRANSACTION_SERIALIZABLE. Static variable in interface java.sql.Connection
Dirty reads, non-repeatable reads and phantom reads are prevented.
transferFocus(). Method in class java.awt.Component
Transfers the focus to the next component.
TRANSIENT. Static variable in class java.lang.reflect.Modifier
translate(int, int). Method in class java.awt.Event
Translates an event relative to the given component.
translate(int, int). Method in class java.awt.Graphics
ww

Translates the origin of the graphics context to the point (x, y) in the current coordinate
system.
translate(int, int). Method in class java.awt.Point
Translates the point.
translate(int, int). Method in class java.awt.Polygon
Translates the vertices by deltaX, deltaY.
translate(int, int). Method in class java.awt.Rectangle
Translates the rectangle.
translatePoint(int, int). Method in class java.awt.event.MouseEvent
Translates the coordinate position of the event by x, y.
trim(). Method in class java.lang.String
Removes white space from both ends of this string.

425
426

trimToSize(). Method in class java.util.Vector


Trims the capacity of this vector to be the vector's current size.
TRUE. Static variable in class java.lang.Boolean

m
The Boolean object corresponding to the primitive value true.
TT_EOF. Static variable in class java.io.StreamTokenizer
A constant indicating that the end of the stream has been read.
TT_EOL. Static variable in class java.io.StreamTokenizer
A constant indicating that the end of the line has been read.
TT_NUMBER. Static variable in class java.io.StreamTokenizer
A constant indicating that a number token has been read.
TT_WORD. Static variable in class java.io.StreamTokenizer

o
A constant indicating that a word token has been read.
ttype. Variable in class java.io.StreamTokenizer
After a call to the nextToken method, this field contains the type of the token just read.
TUESDAY. Static variable in class java.util.Calendar
Useful constant for days of week.

i.c
TYPE. Static variable in class java.lang.Boolean
The Class object representing the primitive type boolean.
TYPE. Static variable in class java.lang.Byte
The Class object representing the primitive type byte.
TYPE. Static variable in class java.lang.Character
The Class object representing the primitive type char.
TYPE. Static variable in class java.lang.Double
The Class object representing the primitive type double.
TYPE. Static variable in class java.lang.Float
The Class object representing the primitive type float.

dil
TYPE. Static variable in class java.lang.Integer
The Class object representing the primitive type int.
TYPE. Static variable in class java.lang.Long
The Class object representing the primitive type long.
TYPE. Static variable in class java.lang.Short
The Class object representing the primitive type short.
TYPE. Static variable in class java.lang.Void
The Class object representing the primitive Java type void.
typeName(). Method in class sun.tools.debug.RemoteArray
Return this RemoteValue's type ("array").
typeName(). Method in class sun.tools.debug.RemoteBoolean
va
Print this RemoteValue's type ("boolean").
typeName(). Method in class sun.tools.debug.RemoteByte
Print this RemoteValue's type ("byte").
typeName(). Method in class sun.tools.debug.RemoteChar
Print this RemoteValue's type ("char").
typeName(). Method in class sun.tools.debug.RemoteClass
Returns the name of the class as its type.
typeName(). Method in class sun.tools.debug.RemoteDouble
Print this RemoteValue's type ("double").
typeName(). Method in class sun.tools.debug.RemoteFloat
ja

Print this RemoteValue's type ("float").


typeName(). Method in class sun.tools.debug.RemoteInt
Print this RemoteValue's type ("int").
typeName(). Method in class sun.tools.debug.RemoteLong
Print this RemoteValue's type ("long").
typeName(). Method in class sun.tools.debug.RemoteObject
Returns the RemoteValue's type name ("Object").
w.

typeName(). Method in class sun.tools.debug.RemoteShort


Print this RemoteValue's type ("short").
typeName(). Method in class sun.tools.debug.RemoteString
Print this RemoteValue's type ("String").
typeName(). Method in class sun.tools.debug.RemoteValue
Returns the RemoteValue's type as a string.
typeNoNulls. Static variable in interface java.sql.DatabaseMetaData
TYPE NULLABLE - does not allow NULL values.
typeNullable. Static variable in interface java.sql.DatabaseMetaData
TYPE NULLABLE - allows NULL values.
ww

typeNullableUnknown. Static variable in interface java.sql.DatabaseMetaData


TYPE NULLABLE - nullability unknown.
typePredBasic. Static variable in interface java.sql.DatabaseMetaData
TYPE INFO SEARCHABLE - Supported except for WHERE ..
typePredChar. Static variable in interface java.sql.DatabaseMetaData
TYPE INFO SEARCHABLE - Only supported with WHERE ..
typePredNone. Static variable in interface java.sql.DatabaseMetaData
TYPE INFO SEARCHABLE - No support.
typeSearchable. Static variable in interface java.sql.DatabaseMetaData
TYPE INFO SEARCHABLE - Supported for all WHERE ...

426
427

m
UID(). Constructor for class java.rmi.server.UID
Create a pure identifier that is unique with respect to the host on which it is generated.
UID(short). Constructor for class java.rmi.server.UID
Create a "well-known" ID.
UK. Static variable in class java.util.Locale
Useful constant for country.
UNASSIGNED. Static variable in class java.lang.Character
unbind(String). Static method in class java.rmi.Naming

o
Unbind the name.
unbind(String). Method in interface java.rmi.registry.Registry
Unbind the name.
uncaughtException(Thread, Throwable). Method in class java.lang.ThreadGroup
Called by the Java Virtual Machine when a thread in this thread group stops because of an

i.c
uncaught exception.
UNDECIMBER. Static variable in class java.util.Calendar
Useful constant for month.
UndefinedProperty. Static variable in class java.awt.Image
The UndefinedProperty object should be returned whenever a property which was not defined for
a particular image is fetched.
UnexpectedException(String). Constructor for class java.rmi.UnexpectedException
Create a new UnexpectedException with a description.
UnexpectedException(String, Exception). Constructor for class java.rmi.UnexpectedException
Create a new UnexpectedException with a description, and detail exception.

dil
UnicastRemoteObject(). Constructor for class java.rmi.server.UnicastRemoteObject
Create and export a new UnicastRemoteObject object using an anonymous port.
UNINITIALIZED. Static variable in class java.security.Signature
Possible state value, signifying that this signature object has not yet been initialized.
union(Rectangle). Method in class java.awt.Rectangle
Computes the union of two rectangles.
UNIT_DECREMENT. Static variable in class java.awt.event.AdjustmentEvent
The unit decrement adjustment type.
UNIT_INCREMENT. Static variable in class java.awt.event.AdjustmentEvent
The unit increment adjustment type.
UnknownError(). Constructor for class java.lang.UnknownError
va
Constructs an UnknownError with no detail message.
UnknownError(String). Constructor for class java.lang.UnknownError
Constructs an UnknownError with the specified detail message.
UnknownHostException(). Constructor for class java.net.UnknownHostException
Constructs a new UnknownHostException with no detail message.
UnknownHostException(String). Constructor for class java.net.UnknownHostException
Constructs a new UnknownHostException with the specified detail message.
UnknownHostException(String). Constructor for class java.rmi.UnknownHostException
Create a new UnknownHostException with a description.
UnknownHostException(String, Exception). Constructor for class java.rmi.UnknownHostException
ja

Create a new UnknownHostException with a description and detail exception.


UnknownServiceException(). Constructor for class java.net.UnknownServiceException
Constructs a new UnknownServiceException with no detail message.
UnknownServiceException(String). Constructor for class java.net.UnknownServiceException
Constructs a new UnknownServiceException with the specified detail message.
UnmarshalException(String). Constructor for class java.rmi.UnmarshalException
Create a new marshal exception with a descriptive string.
w.

UnmarshalException(String, Exception). Constructor for class java.rmi.UnmarshalException


Create a new marshal exception with a descriptive string and an exception.
unread(byte[]). Method in class java.io.PushbackInputStream
Pushes back an array of bytes.
unread(byte[], int, int). Method in class java.io.PushbackInputStream
Pushes back an array of bytes.
unread(char[]). Method in class java.io.PushbackReader
Push back an entire array of characters.
unread(char[], int, int). Method in class java.io.PushbackReader
Push back from an array of characters.
ww

unread(int). Method in class java.io.PushbackInputStream


Pushes back a character so that it is read again by the next call to the read method on this
input stream.
unread(int). Method in class java.io.PushbackReader
Push back a single character.
unreferenced(). Method in interface java.rmi.server.Unreferenced
Called when there are no current references to this remote object.
UnsatisfiedLinkError(). Constructor for class java.lang.UnsatisfiedLinkError
Constructs an UnsatisfiedLinkError with no detail message.
UnsatisfiedLinkError(String). Constructor for class java.lang.UnsatisfiedLinkError
Constructs an UnsatisfiedLinkError with the specified detail message.
UnsupportedEncodingException(). Constructor for class java.io.UnsupportedEncodingException

427
428

no detailed message
UnsupportedEncodingException(String). Constructor for class java.io.UnsupportedEncodingException
detailed message

m
UnsupportedFlavorException(DataFlavor). Constructor for class
java.awt.datatransfer.UnsupportedFlavorException
Constructs an UnsupportedFlavorException.
UP. Static variable in class java.awt.Event
The up arrow action-key.
up(int). Method in class sun.tools.debug.RemoteThread
Change the current stackframe to be one or more frames higher (as in, away from the current
program counter).

o
UPDATE. Static variable in class java.awt.event.PaintEvent
The update event type.
update(byte). Method in class java.security.MessageDigest
Updates the digest using the specified byte.
update(byte). Method in class java.security.Signature

i.c
Updates the data to be signed or verified by a byte.
update(byte[]). Method in class java.util.zip.Adler32
Updates checksum with specified array of bytes.
update(byte[]). Method in class java.util.zip.CRC32
Updates CRC-32 with specified array of bytes.
update(byte[]). Method in class java.security.MessageDigest
Updates the digest using the specified array of bytes.
update(byte[]). Method in class java.security.Signature
Updates the data to be signed or verified, using the specified array of bytes.
update(byte[], int, int). Method in class java.util.zip.Adler32

dil
Updates checksum with specified array of bytes.
update(byte[], int, int). Method in interface java.util.zip.Checksum
Updates the current checksum with the specified array of bytes.
update(byte[], int, int). Method in class java.util.zip.CRC32
Updates CRC-32 with specified array of bytes.
update(byte[], int, int). Method in class java.security.MessageDigest
Updates the digest using the specified array of bytes, starting at the specified offset.
update(byte[], int, int). Method in class java.security.Signature
Updates the data to be signed or verified, using the specified array of bytes, starting at the
specified offset.
update(Graphics). Method in class java.awt.Component
va
Updates the component.
update(int). Method in class java.util.zip.Adler32
Updates checksum with specified byte.
update(int). Method in interface java.util.zip.Checksum
Updates the current checksum with the specified byte.
update(int). Method in class java.util.zip.CRC32
Updates CRC-32 with specified byte.
update(Observable, Object). Method in interface java.util.Observer
This method is called whenever the observed object is changed.
UPPERCASE_LETTER. Static variable in class java.lang.Character
ja

url. Variable in class java.net.URLConnection


The URL represents the remote object on the World Wide Web to which this connection is opened.
URL(String). Constructor for class java.net.URL
Creates a URL object from the String representation.
URL(String, String, int, String). Constructor for class java.net.URL
Creates a URL object from the specified protocol, host, port number, and file.
URL(String, String, String). Constructor for class java.net.URL
w.

Creates an absolute URL from the specified protocol name, host name, and file name.
URL(URL, String). Constructor for class java.net.URL
Creates a URL by parsing the specification spec within a specified context.
URLConnection(URL). Constructor for class java.net.URLConnection
Constructs a URL connection to the specified URL.
URLStreamHandler(). Constructor for class java.net.URLStreamHandler
US. Static variable in class java.util.Locale
Useful constant for country.
useCaches. Variable in class java.net.URLConnection
If true, the protocol is allowed to use caching whenever it can.
ww

useDaylightTime(). Method in class java.util.SimpleTimeZone


Overrides TimeZone Queries if this time zone uses Daylight Savings Time.
useDaylightTime(). Method in class java.util.TimeZone
Queries if this time zone uses Daylight Savings Time.
usesLocalFilePerTable(). Method in interface java.sql.DatabaseMetaData
Does the database use a file for each table?
usesLocalFiles(). Method in interface java.sql.DatabaseMetaData
Does the database store tables in a local file?
usesShiftModifier(). Method in class java.awt.MenuShortcut
Return whether this MenuShortcut must be invoked using the SHIFT key.
usingProxy(). Method in class java.net.HttpURLConnection
Indicates if the connection is going through a proxy.

428
429

UTC(int, int, int, int, int, int). Static method in class java.util.Date
Determines the date and time based on the arguments.
UTFDataFormatException(). Constructor for class java.io.UTFDataFormatException

m
Constructs a UTFDataFormatException with no detail message.
UTFDataFormatException(String). Constructor for class java.io.UTFDataFormatException
Constructs a UTFDataFormatException with the specified detail message.

o
valid(). Method in class java.io.FileDescriptor
Tests if this file descriptor object is valid.
validate(). Method in class java.awt.Component
Ensures that a component has a valid layout.
validate(). Method in class java.awt.Container

i.c
Validates this Container and all of the components contained within it.
validateObject(). Method in interface java.io.ObjectInputValidation
Validates the object
validateTree(). Method in class java.awt.Container
Recursively descends the container tree and recomputes the layout for any subtrees marked as
needing it (those marked as invalid).
value. Variable in class java.sql.DriverPropertyInfo
"value" specifies the current value of the property, based on a combination of the information
supplied to getPropertyInfo, the Java environment, and driver supplied default values.
valueOf(boolean). Static method in class java.lang.String

dil
Returns the string representation of the boolean argument.
valueOf(char). Static method in class java.lang.String
Returns the string representation of the char * argument.
valueOf(char[]). Static method in class java.lang.String
Returns the string representation of the char array argument.
valueOf(char[], int, int). Static method in class java.lang.String
Returns the string representation of a specific subarray of the char array argument.
valueOf(double). Static method in class java.lang.String
Returns the string representation of the double argument.
valueOf(float). Static method in class java.lang.String
Returns the string representation of the float argument.
va
valueOf(int). Static method in class java.lang.String
Returns the string representation of the int argument.
valueOf(long). Static method in class java.math.BigDecimal
Returns a BigDecimal with the given value and a scale of zero.
valueOf(long). Static method in class java.math.BigInteger
Returns a BigInteger with the specified value.
valueOf(long). Static method in class java.lang.String
Returns the string representation of the long argument.
valueOf(long, int). Static method in class java.math.BigDecimal
Returns a BigDecimal with a value of (val/10**scale).
ja

valueOf(Object). Static method in class java.lang.String


Returns the string representation of the Object argument.
valueOf(String). Static method in class java.lang.Boolean
Returns the boolean value represented by the specified String.
valueOf(String). Static method in class java.lang.Byte
Assuming the specified String represents a byte, returns a new Byte object initialized to that
value.
w.

valueOf(String). Static method in class java.sql.Date


Convert a string in JDBC date escape format to a Date value
valueOf(String). Static method in class java.lang.Double
Returns a new Double value initialized to the value represented by the specified String.
valueOf(String). Static method in class java.lang.Float
Returns the floating point value represented by the specified String.
valueOf(String). Static method in class java.lang.Integer
Returns a new Integer object initialized to the value of the specified String.
valueOf(String). Static method in class java.lang.Long
Returns a new long object initialized to the value of the specified String.
ww

valueOf(String). Static method in class java.lang.Short


Assuming the specified String represents a short, returns a new Short object initialized to
that value.
valueOf(String). Static method in class java.sql.Time
Convert a string in JDBC time escape format to a Time value
valueOf(String). Static method in class java.sql.Timestamp
Convert a string in JDBC timestamp escape format to a Timestamp value
valueOf(String, int). Static method in class java.lang.Byte
Assuming the specified String represents a byte, returns a new Byte object initialized to that
value.
valueOf(String, int). Static method in class java.lang.Integer
Returns a new Integer object initialized to the value of the specified String.

429
430

valueOf(String, int). Static method in class java.lang.Long


Returns a new long object initialized to the value of the specified String.
valueOf(String, int). Static method in class java.lang.Short

m
Assuming the specified String represents a short, returns a new Short object initialized to
that value.
VARBINARY. Static variable in class java.sql.Types
VARCHAR. Static variable in class java.sql.Types
Vector(). Constructor for class java.util.Vector
Constructs an empty vector.
Vector(int). Constructor for class java.util.Vector
Constructs an empty vector with the specified initial capacity.

o
Vector(int, int). Constructor for class java.util.Vector
Constructs an empty vector with the specified initial capacity and capacity increment.
VERBOSE. Static variable in class java.rmi.server.LogStream
VERIFY. Static variable in class java.security.Signature
Possible state value, signifying that this signature object has been initialized for

i.c
verification.
verify(byte[]). Method in class java.security.Signature
Verifies the passed-in signature.
VerifyError(). Constructor for class java.lang.VerifyError
Constructs an VerifyError with no detail message.
VerifyError(String). Constructor for class java.lang.VerifyError
Constructs an VerifyError with the specified detail message.
versionColumnNotPseudo. Static variable in interface java.sql.DatabaseMetaData
VERSION COLUMNS PSEUDO_COLUMN - is NOT a pseudo column.
versionColumnPseudo. Static variable in interface java.sql.DatabaseMetaData

dil
VERSION COLUMNS PSEUDO_COLUMN - is a pseudo column.
versionColumnUnknown. Static variable in interface java.sql.DatabaseMetaData
VERSION COLUMNS PSEUDO_COLUMN - may or may not be pseudo column.
VERTICAL. Static variable in interface java.awt.Adjustable
The vertical orientation.
VERTICAL. Static variable in class java.awt.GridBagConstraints
VERTICAL. Static variable in class java.awt.Scrollbar
The vertical Scrollbar variable.
vetoableChange(PropertyChangeEvent). Method in interface java.beans.VetoableChangeListener
This method gets called when a constrained property is changed.
VetoableChangeSupport(Object). Constructor for class java.beans.VetoableChangeSupport
va
VirtualMachineError(). Constructor for class java.lang.VirtualMachineError
Constructs a VirtualMachineError with no detail message.
VirtualMachineError(String). Constructor for class java.lang.VirtualMachineError
Constructs a VirtualMachineError with the specified detail message.
VK_0. Static variable in class java.awt.event.KeyEvent
VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39)
VK_1. Static variable in class java.awt.event.KeyEvent
VK_2. Static variable in class java.awt.event.KeyEvent
VK_3. Static variable in class java.awt.event.KeyEvent
VK_4. Static variable in class java.awt.event.KeyEvent
ja

VK_5. Static variable in class java.awt.event.KeyEvent


VK_6. Static variable in class java.awt.event.KeyEvent
VK_7. Static variable in class java.awt.event.KeyEvent
VK_8. Static variable in class java.awt.event.KeyEvent
VK_9. Static variable in class java.awt.event.KeyEvent
VK_A. Static variable in class java.awt.event.KeyEvent
VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A)
w.

VK_ACCEPT. Static variable in class java.awt.event.KeyEvent


VK_ADD. Static variable in class java.awt.event.KeyEvent
VK_ALT. Static variable in class java.awt.event.KeyEvent
VK_B. Static variable in class java.awt.event.KeyEvent
VK_BACK_QUOTE. Static variable in class java.awt.event.KeyEvent
VK_BACK_SLASH. Static variable in class java.awt.event.KeyEvent
VK_BACK_SPACE. Static variable in class java.awt.event.KeyEvent
VK_C. Static variable in class java.awt.event.KeyEvent
VK_CANCEL. Static variable in class java.awt.event.KeyEvent
VK_CAPS_LOCK. Static variable in class java.awt.event.KeyEvent
ww

VK_CLEAR. Static variable in class java.awt.event.KeyEvent


VK_CLOSE_BRACKET. Static variable in class java.awt.event.KeyEvent
VK_COMMA. Static variable in class java.awt.event.KeyEvent
VK_CONTROL. Static variable in class java.awt.event.KeyEvent
VK_CONVERT. Static variable in class java.awt.event.KeyEvent
VK_D. Static variable in class java.awt.event.KeyEvent
VK_DECIMAL. Static variable in class java.awt.event.KeyEvent
VK_DELETE. Static variable in class java.awt.event.KeyEvent
VK_DIVIDE. Static variable in class java.awt.event.KeyEvent
VK_DOWN. Static variable in class java.awt.event.KeyEvent
VK_E. Static variable in class java.awt.event.KeyEvent
VK_END. Static variable in class java.awt.event.KeyEvent

430
431

VK_ENTER. Static variable in class java.awt.event.KeyEvent


Virtual key codes.
VK_EQUALS. Static variable in class java.awt.event.KeyEvent

m
VK_ESCAPE. Static variable in class java.awt.event.KeyEvent
VK_F. Static variable in class java.awt.event.KeyEvent
VK_F1. Static variable in class java.awt.event.KeyEvent
VK_F10. Static variable in class java.awt.event.KeyEvent
VK_F11. Static variable in class java.awt.event.KeyEvent
VK_F12. Static variable in class java.awt.event.KeyEvent
VK_F2. Static variable in class java.awt.event.KeyEvent
VK_F3. Static variable in class java.awt.event.KeyEvent

o
VK_F4. Static variable in class java.awt.event.KeyEvent
VK_F5. Static variable in class java.awt.event.KeyEvent
VK_F6. Static variable in class java.awt.event.KeyEvent
VK_F7. Static variable in class java.awt.event.KeyEvent
VK_F8. Static variable in class java.awt.event.KeyEvent

i.c
VK_F9. Static variable in class java.awt.event.KeyEvent
VK_FINAL. Static variable in class java.awt.event.KeyEvent
for Asian Keyboard
VK_G. Static variable in class java.awt.event.KeyEvent
VK_H. Static variable in class java.awt.event.KeyEvent
VK_HELP. Static variable in class java.awt.event.KeyEvent
VK_HOME. Static variable in class java.awt.event.KeyEvent
VK_I. Static variable in class java.awt.event.KeyEvent
VK_INSERT. Static variable in class java.awt.event.KeyEvent
VK_J. Static variable in class java.awt.event.KeyEvent

dil
VK_K. Static variable in class java.awt.event.KeyEvent
VK_KANA. Static variable in class java.awt.event.KeyEvent
VK_KANJI. Static variable in class java.awt.event.KeyEvent
VK_L. Static variable in class java.awt.event.KeyEvent
VK_LEFT. Static variable in class java.awt.event.KeyEvent
VK_M. Static variable in class java.awt.event.KeyEvent
VK_META. Static variable in class java.awt.event.KeyEvent
VK_MODECHANGE. Static variable in class java.awt.event.KeyEvent
VK_MULTIPLY. Static variable in class java.awt.event.KeyEvent
VK_N. Static variable in class java.awt.event.KeyEvent
VK_NONCONVERT. Static variable in class java.awt.event.KeyEvent
va
VK_NUM_LOCK. Static variable in class java.awt.event.KeyEvent
VK_NUMPAD0. Static variable in class java.awt.event.KeyEvent
VK_NUMPAD1. Static variable in class java.awt.event.KeyEvent
VK_NUMPAD2. Static variable in class java.awt.event.KeyEvent
VK_NUMPAD3. Static variable in class java.awt.event.KeyEvent
VK_NUMPAD4. Static variable in class java.awt.event.KeyEvent
VK_NUMPAD5. Static variable in class java.awt.event.KeyEvent
VK_NUMPAD6. Static variable in class java.awt.event.KeyEvent
VK_NUMPAD7. Static variable in class java.awt.event.KeyEvent
VK_NUMPAD8. Static variable in class java.awt.event.KeyEvent
ja

VK_NUMPAD9. Static variable in class java.awt.event.KeyEvent


VK_O. Static variable in class java.awt.event.KeyEvent
VK_OPEN_BRACKET. Static variable in class java.awt.event.KeyEvent
VK_P. Static variable in class java.awt.event.KeyEvent
VK_PAGE_DOWN. Static variable in class java.awt.event.KeyEvent
VK_PAGE_UP. Static variable in class java.awt.event.KeyEvent
VK_PAUSE. Static variable in class java.awt.event.KeyEvent
w.

VK_PERIOD. Static variable in class java.awt.event.KeyEvent


VK_PRINTSCREEN. Static variable in class java.awt.event.KeyEvent
VK_Q. Static variable in class java.awt.event.KeyEvent
VK_QUOTE. Static variable in class java.awt.event.KeyEvent
VK_R. Static variable in class java.awt.event.KeyEvent
VK_RIGHT. Static variable in class java.awt.event.KeyEvent
VK_S. Static variable in class java.awt.event.KeyEvent
VK_SCROLL_LOCK. Static variable in class java.awt.event.KeyEvent
VK_SEMICOLON. Static variable in class java.awt.event.KeyEvent
VK_SEPARATER. Static variable in class java.awt.event.KeyEvent
ww

VK_SHIFT. Static variable in class java.awt.event.KeyEvent


VK_SLASH. Static variable in class java.awt.event.KeyEvent
VK_SPACE. Static variable in class java.awt.event.KeyEvent
VK_SUBTRACT. Static variable in class java.awt.event.KeyEvent
VK_T. Static variable in class java.awt.event.KeyEvent
VK_TAB. Static variable in class java.awt.event.KeyEvent
VK_U. Static variable in class java.awt.event.KeyEvent
VK_UNDEFINED. Static variable in class java.awt.event.KeyEvent
KEY_TYPED events do not have a defined keyCode.
VK_UP. Static variable in class java.awt.event.KeyEvent
VK_V. Static variable in class java.awt.event.KeyEvent
VK_W. Static variable in class java.awt.event.KeyEvent

431
432

VK_X. Static variable in class java.awt.event.KeyEvent


VK_Y. Static variable in class java.awt.event.KeyEvent
VK_Z. Static variable in class java.awt.event.KeyEvent

m
VMID(). Constructor for class java.rmi.dgc.VMID
Create a new VMID.
VOLATILE. Static variable in class java.lang.reflect.Modifier

o
W_RESIZE_CURSOR. Static variable in class java.awt.Cursor
The west-resize cursor type.
W_RESIZE_CURSOR. Static variable in class java.awt.Frame
wait(). Method in class java.lang.Object
Waits to be notified by another thread of a change in this object.

i.c
wait(long). Method in class java.lang.Object
Waits to be notified by another thread of a change in this object.
wait(long, int). Method in class java.lang.Object
Waits to be notified by another thread of a change in this object.
WAIT_CURSOR. Static variable in class java.awt.Cursor
The wait cursor type.
WAIT_CURSOR. Static variable in class java.awt.Frame
waitFor(). Method in class java.lang.Process
Waits for the subprocess to complete.
waitForAll(). Method in class java.awt.MediaTracker

dil
Starts loading all images.
waitForAll(long). Method in class java.awt.MediaTracker
Starts loading all images.
waitForID(int). Method in class java.awt.MediaTracker
Starts loading all images with the specified ID and waits until they have finished loading or
receive an error.
waitForID(int, long). Method in class java.awt.MediaTracker
Starts loading all images with the specified ID.
wasNull(). Method in interface java.sql.CallableStatement
An OUT parameter may have the value of SQL NULL; wasNull reports whether the last value read
has this special value.
va
wasNull(). Method in interface java.sql.ResultSet
A column may have the value of SQL NULL; wasNull reports whether the last column read had this
special value.
WEDNESDAY. Static variable in class java.util.Calendar
Useful constant for days of week.
WEEK_OF_MONTH. Static variable in class java.util.Calendar
Useful constant for date and time.
WEEK_OF_MONTH_FIELD. Static variable in class java.text.DateFormat
Useful constant for WEEK_OF_MONTH field alignment.
WEEK_OF_YEAR. Static variable in class java.util.Calendar
ja

Useful constant for date and time.


WEEK_OF_YEAR_FIELD. Static variable in class java.text.DateFormat
Useful constant for WEEK_OF_YEAR field alignment.
weightx. Variable in class java.awt.GridBagConstraints
weighty. Variable in class java.awt.GridBagConstraints
WEST. Static variable in class java.awt.BorderLayout
The west layout constraint.
w.

WEST. Static variable in class java.awt.GridBagConstraints


when. Variable in class java.awt.Event
The time stamp.
white. Static variable in class java.awt.Color
The color white.
whitespaceChars(int, int). Method in class java.io.StreamTokenizer
Specifies that all characters c in the range low <= c <= high are white space characters.
width. Variable in class java.awt.Dimension
The width dimension.
WIDTH. Static variable in interface java.awt.image.ImageObserver
ww

The width of the base image is now available and can be taken from the width argument to the
imageUpdate callback method.
width. Variable in class java.awt.Rectangle
The width of the rectangle.
window. Static variable in class java.awt.SystemColor
The background color for windows.
WINDOW. Static variable in class java.awt.SystemColor
The array index for the window background color.
Window(Frame). Constructor for class java.awt.Window
Constructs a new Window initialized to an invisible state.
WINDOW_ACTIVATED. Static variable in class java.awt.event.WindowEvent
The window activated event type.

432
433

WINDOW_BORDER. Static variable in class java.awt.SystemColor


The array index for the window border color.
WINDOW_CLOSED. Static variable in class java.awt.event.WindowEvent

m
The window closed event type.
WINDOW_CLOSING. Static variable in class java.awt.event.WindowEvent
The window closing event type.
WINDOW_DEACTIVATED. Static variable in class java.awt.event.WindowEvent
The window deactivated event type.
WINDOW_DEICONIFIED. Static variable in class java.awt.event.WindowEvent
The window deiconified event type.
WINDOW_DEICONIFY. Static variable in class java.awt.Event

o
The de-iconify window event.
WINDOW_DESTROY. Static variable in class java.awt.Event
The destroy window event.
WINDOW_EVENT_MASK. Static variable in class java.awt.AWTEvent
The event mask for selecting window events.

i.c
WINDOW_EXPOSE. Static variable in class java.awt.Event
The expose window event.
WINDOW_FIRST. Static variable in class java.awt.event.WindowEvent
Marks the first integer id for the range of window event ids.
WINDOW_ICONIFIED. Static variable in class java.awt.event.WindowEvent
The window iconified event type.
WINDOW_ICONIFY. Static variable in class java.awt.Event
The iconify window event.
WINDOW_LAST. Static variable in class java.awt.event.WindowEvent
Marks the last integer id for the range of window event ids.

dil
WINDOW_MOVED. Static variable in class java.awt.Event
The move window event.
WINDOW_OPENED. Static variable in class java.awt.event.WindowEvent
The window opened event type.
WINDOW_TEXT. Static variable in class java.awt.SystemColor
The array index for the window text color.
windowActivated(WindowEvent). Method in class java.awt.AWTEventMulticaster
Handles the windowActivated event by invoking the windowActivated methods on listener-a and
listener-b.
windowActivated(WindowEvent). Method in class java.awt.event.WindowAdapter
windowActivated(WindowEvent). Method in interface java.awt.event.WindowListener
va
Invoked when a window is activated.
WindowAdapter(). Constructor for class java.awt.event.WindowAdapter
windowBorder. Static variable in class java.awt.SystemColor
The border color for windows.
windowClosed(WindowEvent). Method in class java.awt.AWTEventMulticaster
Handles the windowClosed event by invoking the windowClosed methods on listener-a and
listener-b.
windowClosed(WindowEvent). Method in class java.awt.event.WindowAdapter
windowClosed(WindowEvent). Method in interface java.awt.event.WindowListener
Invoked when a window has been closed.
ja

windowClosing(WindowEvent). Method in class java.awt.AWTEventMulticaster


Handles the windowClosing event by invoking the windowClosing methods on listener-a and
listener-b.
windowClosing(WindowEvent). Method in class java.awt.event.WindowAdapter
windowClosing(WindowEvent). Method in interface java.awt.event.WindowListener
Invoked when a window is in the process of being closed.
windowDeactivated(WindowEvent). Method in class java.awt.AWTEventMulticaster
w.

Handles the windowDeactivated event by invoking the windowDeactivated methods on listener-a


and listener-b.
windowDeactivated(WindowEvent). Method in class java.awt.event.WindowAdapter
windowDeactivated(WindowEvent). Method in interface java.awt.event.WindowListener
Invoked when a window is de-activated.
windowDeiconified(WindowEvent). Method in class java.awt.AWTEventMulticaster
Handles the windowDeiconfied event by invoking the windowDeiconified methods on listener-a and
listener-b.
windowDeiconified(WindowEvent). Method in class java.awt.event.WindowAdapter
windowDeiconified(WindowEvent). Method in interface java.awt.event.WindowListener
ww

Invoked when a window is de-iconified.


WindowEvent(Window, int). Constructor for class java.awt.event.WindowEvent
Constructs a WindowEvent object with the specified source window and type.
windowIconified(WindowEvent). Method in class java.awt.AWTEventMulticaster
Handles the windowIconified event by invoking the windowIconified methods on listener-a and
listener-b.
windowIconified(WindowEvent). Method in class java.awt.event.WindowAdapter
windowIconified(WindowEvent). Method in interface java.awt.event.WindowListener
Invoked when a window is iconified.
windowOpened(WindowEvent). Method in class java.awt.AWTEventMulticaster
Handles the windowOpened event by invoking the windowOpened methods on listener-a and
listener-b.

433
434

windowOpened(WindowEvent). Method in class java.awt.event.WindowAdapter


windowOpened(WindowEvent). Method in interface java.awt.event.WindowListener
Invoked when a window has been opened.

m
windowText. Static variable in class java.awt.SystemColor
The text color for windows.
wordChars(int, int). Method in class java.io.StreamTokenizer
Specifies that all characters c in the range low <= c <= high are word constituents.
write(byte[]). Method in interface java.io.DataOutput
Writes b.length bytes from the specified byte array to this output stream.
write(byte[]). Method in class java.io.FileOutputStream
Writes b.length bytes from the specified byte array to this file output stream.

o
write(byte[]). Method in class java.io.FilterOutputStream
Writes b.length bytes to this output stream.
write(byte[]). Method in interface java.io.ObjectOutput
Writes an array of bytes.
write(byte[]). Method in class java.io.ObjectOutputStream

i.c
Writes an array of bytes.
write(byte[]). Method in class java.io.OutputStream
Writes b.length bytes from the specified byte array to this output stream.
write(byte[]). Method in class java.io.RandomAccessFile
Writes b.length bytes from the specified byte array starting at offset off to this file.
write(byte[], int, int). Method in class java.io.BufferedOutputStream
Writes len bytes from the specified byte array starting at offset off to this buffered output
stream.
write(byte[], int, int). Method in class java.io.ByteArrayOutputStream
Writes len bytes from the specified byte array starting at offset off to this byte array

dil
output stream.
write(byte[], int, int). Method in class java.util.zip.CheckedOutputStream
Writes an array of bytes.
write(byte[], int, int). Method in interface java.io.DataOutput
Writes len bytes from the specified byte array starting at offset off to this output stream.
write(byte[], int, int). Method in class java.io.DataOutputStream
Writes len bytes from the specified byte array starting at offset off to the underlying output
stream.
write(byte[], int, int). Method in class java.util.zip.DeflaterOutputStream
Writes an array of bytes to the compressed output stream.
write(byte[], int, int). Method in class java.security.DigestOutputStream
va
Updates the message digest (if the digest function is on) using the specified subarray, and in
any case writes the subarray to the output stream.
write(byte[], int, int). Method in class java.io.FileOutputStream
Writes len bytes from the specified byte array starting at offset off to this file output
stream.
write(byte[], int, int). Method in class java.io.FilterOutputStream
Writes len bytes from the specified byte array starting at offset off to this output stream.
write(byte[], int, int). Method in class java.util.zip.GZIPOutputStream
Writes array of bytes to the compressed output stream.
write(byte[], int, int). Method in class java.rmi.server.LogStream
ja

Write a subarray of bytes.


write(byte[], int, int). Method in interface java.io.ObjectOutput
Writes a sub array of bytes.
write(byte[], int, int). Method in class java.io.ObjectOutputStream
Writes a sub array of bytes.
write(byte[], int, int). Method in class java.io.OutputStream
Writes len bytes from the specified byte array starting at offset off to this output stream.
w.

write(byte[], int, int). Method in class java.io.PipedOutputStream


Writes len bytes from the specified byte array starting at offset off to this piped output
stream.
write(byte[], int, int). Method in class java.io.PrintStream
Writes a portion of the specified byte array, blocking if necessary.
write(byte[], int, int). Method in class java.io.RandomAccessFile
Writes len bytes from the specified byte array starting at offset off to this file.
write(byte[], int, int). Method in class java.util.zip.ZipOutputStream
Writes an array of bytes to the current ZIP entry data.
write(char[]). Method in class java.io.PrintWriter
ww

Write an array of characters.


write(char[]). Method in class java.io.Writer
Write an array of characters.
write(char[], int, int). Method in class java.io.BufferedWriter
Write a portion of an array of characters.
write(char[], int, int). Method in class java.io.CharArrayWriter
Writes characters to the buffer.
write(char[], int, int). Method in class java.io.FilterWriter
Write a portion of an array of characters.
write(char[], int, int). Method in class java.io.OutputStreamWriter
Write a portion of an array of characters.
write(char[], int, int). Method in class java.io.PipedWriter

434
435

Write a portion of an array of characters.


write(char[], int, int). Method in class java.io.PrintWriter
Write a portion of an array of characters.

m
write(char[], int, int). Method in class java.io.StringWriter
Write a portion of an array of characters.
write(char[], int, int). Method in class java.io.Writer
Write a portion of an array of characters.
write(DataOutput). Method in class java.rmi.server.UID
Write uid to output stream.
write(int). Method in class java.io.BufferedOutputStream
Writes the specified byte to this buffered output stream.

o
write(int). Method in class java.io.BufferedWriter
Write a single character.
write(int). Method in class java.io.ByteArrayOutputStream
Writes the specified byte to this byte array output stream.
write(int). Method in class java.io.CharArrayWriter

i.c
Writes a character to the buffer.
write(int). Method in class java.util.zip.CheckedOutputStream
Writes a byte.
write(int). Method in interface java.io.DataOutput
Writes the specified byte to this data output stream.
write(int). Method in class java.io.DataOutputStream
Writes the specified byte to the underlying output stream.
write(int). Method in class java.util.zip.DeflaterOutputStream
Writes a byte to the compressed output stream.
write(int). Method in class java.security.DigestOutputStream

dil
Updates the message digest (if the digest function is on) using the specified byte, and in any
case writes the byte to the output stream.
write(int). Method in class java.io.FileOutputStream
Writes the specified byte to this file output stream.
write(int). Method in class java.io.FilterOutputStream
Writes the specified byte to this output stream.
write(int). Method in class java.io.FilterWriter
Write a single character.
write(int). Method in class java.rmi.server.LogStream
Write a byte of data to the stream.
write(int). Method in interface java.io.ObjectOutput
va
Writes a byte.
write(int). Method in class java.io.ObjectOutputStream
Writes a byte.
write(int). Method in class java.io.OutputStream
Writes the specified byte to this output stream.
write(int). Method in class java.io.OutputStreamWriter
Write a single character.
write(int). Method in class java.io.PipedOutputStream
Writes the specified byte to the piped output stream.
write(int). Method in class java.io.PrintStream
ja

Writes the specified byte to this print stream.


write(int). Method in class java.io.PrintWriter
Write a single character.
write(int). Method in class java.io.RandomAccessFile
Writes the specified byte to this file.
write(int). Method in class java.io.StringWriter
Write a single character.
w.

write(int). Method in class java.io.Writer


Write a single character.
write(ObjectOutput). Method in class java.rmi.server.ObjID
Marshal object id to output stream.
write(String). Method in class java.io.PrintWriter
Write a string.
write(String). Method in class java.io.StringWriter
Write a string.
write(String). Method in class java.io.Writer
Write a string.
ww

write(String, int, int). Method in class java.io.BufferedWriter


Write a portion of a String.
write(String, int, int). Method in class java.io.CharArrayWriter
Write a portion of a string to the buffer.
write(String, int, int). Method in class java.io.FilterWriter
Write a portion of a string.
write(String, int, int). Method in class java.io.OutputStreamWriter
Write a portion of a string.
write(String, int, int). Method in class java.io.PrintWriter
Write a portion of a string.
write(String, int, int). Method in class java.io.StringWriter
Write a portion of a string.

435
436

write(String, int, int). Method in class java.io.Writer


Write a portion of a string.
WriteAbortedException(String, Exception). Constructor for class java.io.WriteAbortedException

m
A WriteAbortedException is thrown during a read when one of the ObjectStreamExceptions was
thrown during writing.
writeBoolean(boolean). Method in interface java.io.DataOutput
Writes a boolean value to this output stream.
writeBoolean(boolean). Method in class java.io.DataOutputStream
Writes a boolean to the underlying output stream as a 1-byte value.
writeBoolean(boolean). Method in class java.io.ObjectOutputStream
Writes a boolean.

o
writeBoolean(boolean). Method in class java.io.RandomAccessFile
Writes a boolean to the file as a 1-byte value.
writeByte(int). Method in interface java.io.DataOutput
Writes an 8-bit value to this output stream.
writeByte(int). Method in class java.io.DataOutputStream

i.c
Writes out a byte to the underlying output stream as a 1-byte value.
writeByte(int). Method in class java.io.ObjectOutputStream
Writes an 8 bit byte.
writeByte(int). Method in class java.io.RandomAccessFile
Writes a byte to the file as a 1-byte value.
writeBytes(String). Method in interface java.io.DataOutput
Writes a string to this output stream.
writeBytes(String). Method in class java.io.DataOutputStream
Writes out the string to the underlying output stream as a sequence of bytes.
writeBytes(String). Method in class java.io.ObjectOutputStream

dil
Writes a String as a sequence of bytes.
writeBytes(String). Method in class java.io.RandomAccessFile
Writes the string to the file as a sequence of bytes.
writeChar(int). Method in interface java.io.DataOutput
Writes a char value to this output stream.
writeChar(int). Method in class java.io.DataOutputStream
Writes a char to the underlying output stream as a 2-byte value, high byte first.
writeChar(int). Method in class java.io.ObjectOutputStream
Writes a 16 bit char.
writeChar(int). Method in class java.io.RandomAccessFile
Writes a char to the file as a 2-byte value, high byte first.
va
writeChars(String). Method in interface java.io.DataOutput
Writes a string to this output stream.
writeChars(String). Method in class java.io.DataOutputStream
Writes a string to the underlying output stream as a sequence of characters.
writeChars(String). Method in class java.io.ObjectOutputStream
Writes a String as a sequence of chars.
writeChars(String). Method in class java.io.RandomAccessFile
Writes a string to the file as a sequence of characters.
writeDouble(double). Method in interface java.io.DataOutput
Writes a double value to this output stream.
ja

writeDouble(double). Method in class java.io.DataOutputStream


Converts the double argument to a long using the doubleToLongBits method in class Double, and
then writes that long value to the underlying output stream as an 8-byte quantity, high byte
first.
writeDouble(double). Method in class java.io.ObjectOutputStream
Writes a 64 bit double.
writeDouble(double). Method in class java.io.RandomAccessFile
w.

Converts the double argument to a long using the doubleToLongBits method in class Double, and
then writes that long value to the file as an 8-byte quantity, high byte first.
writeExternal(ObjectOutput). Method in interface java.io.Externalizable
The object implements the writeExternal method to save its contents by calling the methods of
DataOutput for its primitive values or calling the writeObject method of ObjectOutput for
objects, strings and arrays.
writeFloat(float). Method in interface java.io.DataOutput
Writes a float value to this output stream.
writeFloat(float). Method in class java.io.DataOutputStream
Converts the float argument to an int using the floatToIntBits method in class Float, and then
ww

writes that int value to the underlying output stream as a 4-byte quantity, high byte first.
writeFloat(float). Method in class java.io.ObjectOutputStream
Writes a 32 bit float.
writeFloat(float). Method in class java.io.RandomAccessFile
Converts the float argument to an int using the floatToIntBits method in class Float, and then
writes that int value to the file as a 4-byte quantity, high byte first.
writeInt(int). Method in interface java.io.DataOutput
Writes an int value to this output stream.
writeInt(int). Method in class java.io.DataOutputStream
Writes an int to the underlying output stream as four bytes, high byte first.
writeInt(int). Method in class java.io.ObjectOutputStream
Writes a 32 bit int.

436
437

writeInt(int). Method in class java.io.RandomAccessFile


Writes an int to the file as four bytes, high byte first.
writeLong(long). Method in interface java.io.DataOutput

m
Writes a long value to this output stream.
writeLong(long). Method in class java.io.DataOutputStream
Writes a long to the underlying output stream as eight bytes, high byte first.
writeLong(long). Method in class java.io.ObjectOutputStream
Writes a 64 bit long.
writeLong(long). Method in class java.io.RandomAccessFile
Writes a long to the file as eight bytes, high byte first.
writeObject(Object). Method in interface java.io.ObjectOutput

o
Write an object to the underlying storage or stream.
writeObject(Object). Method in class java.io.ObjectOutputStream
Write the specified object to the ObjectOutputStream.
Writer(). Constructor for class java.io.Writer
Create a new character-stream writer whose critical sections will synchronize on the writer

i.c
itself.
Writer(Object). Constructor for class java.io.Writer
Create a new character-stream writer whose critical sections will synchronize on the given
object.
writeShort(int). Method in interface java.io.DataOutput
Writes a 16-bit value to this output stream.
writeShort(int). Method in class java.io.DataOutputStream
Writes a short to the underlying output stream as two bytes, high byte first.
writeShort(int). Method in class java.io.ObjectOutputStream
Writes a 16 bit short.

dil
writeShort(int). Method in class java.io.RandomAccessFile
Writes a short to the file as two bytes, high byte first.
writeStreamHeader(). Method in class java.io.ObjectOutputStream
The writeStreamHeader method is provided so subclasses can append or prepend their own header
to the stream.
writeTo(OutputStream). Method in class java.io.ByteArrayOutputStream
Writes the complete contents of this byte array output stream to the specified output stream
argument, as if by calling the output stream's write method using out.write(buf, 0, count).
writeTo(Writer). Method in class java.io.CharArrayWriter
Writes the contents of the buffer to another character stream.
writeUTF(String). Method in interface java.io.DataOutput
va
Writes a Unicode string by encoding it using modified UTF-8 format.
writeUTF(String). Method in class java.io.DataOutputStream
Writes a string to the underlying output stream using UTF-8 encoding in a machine-independent
manner.
writeUTF(String). Method in class java.io.ObjectOutputStream
Writes a String in UTF format.
writeUTF(String). Method in class java.io.RandomAccessFile
Writes a string to the file using UTF-8 encoding in a machine-independent manner.
written. Variable in class java.io.DataOutputStream
The number of bytes written to the data output stream.
ja

x. Variable in class java.awt.Event


The x coordinate of the event.
w.

x. Variable in class java.awt.Point


The x coordinate.
x. Variable in class java.awt.Rectangle
The x coordinate of the rectangle.
xor(BigInteger). Method in class java.math.BigInteger
Returns a BigInteger whose value is (this ^ val).
xor(BitSet). Method in class java.util.BitSet
Performs a logical XOR of this bit set with the bit set argument.
xpoints. Variable in class java.awt.Polygon
The array of x coordinates.
ww

y. Variable in class java.awt.Event


The y coordinate of the event.
y. Variable in class java.awt.Point
The y coordinate.
y. Variable in class java.awt.Rectangle
The y coordinate of the rectangle.
YEAR. Static variable in class java.util.Calendar

437
438

Useful constant for date and time.


YEAR_FIELD. Static variable in class java.text.DateFormat
Useful constant for YEAR field alignment.

m
yellow. Static variable in class java.awt.Color
The color yellow.
yield(). Static method in class java.lang.Thread
Causes the currently executing thread object to temporarily pause and allow other threads to
execute.
ypoints. Variable in class java.awt.Polygon
The array of y coordinates.

o
i.c
dil
ja va
w.
ww

438

You might also like