Public class test{
static void go(Integer x){
System.out.println("Integer");
}
static void go(long x){
System.out.println("long");
}
static void go(byte x){
System.out.println("byte");
}
static void go(char x){
System.out.println("char");
}
public static void main(String[]args) {
int i=5;
go(i);
}
Console: netice long olacaq.cunki java setir setir oxuyur.ilk once ozone uygun primitive tipi axtarir.yeni kohne usuldan istifade edir.eger ozune uygun primitive zeif olarsa o zaman ozunun wrapper novunu secir.serte gore:
1. Primitive tip
2. Wrapper
3. “…” istifade olunur.
Int longun terkibinde oldugundan ve long evvelde geldiyi ucun longu secir.yeni
X=I;
Olur.int long-a menimsedilir.(32 bit 64 bite menimsedilir).eger int-e uygun int,long double olsa o zaman int ilk once ozone en yaxin olan int-I goturecek.eger int olmasa o zaman longu goturecek.yeni ozune uygun olan bitden yuxariya dogru olanlari goturecek.
Wednesday, February 29, 2012
Tuesday, February 14, 2012
Thursday, February 9, 2012
JTextField Set Number
Event > key > KeyPressed
Asagidaki kodu yazinca ancak number kabul edir.
String value = txtNeceye.getText();
int l = value.length();
System.out.println(evt.getKeyCode());
if ((evt.getKeyChar() >= '0' && evt.getKeyChar() <= '9') || evt.getKeyCode()==8 || evt.getKeyCode()==127|| evt.getKeyCode()==37|| evt.getKeyCode()==39) {
txtNeceye.setEditable(true);
//label.setText("");
} else {
txtNeceye.setEditable(false);
//.setText("* Enter only numeric digits(0-9)");
}
Asagidaki kodu yazinca ancak number kabul edir.
String value = txtNeceye.getText();
int l = value.length();
System.out.println(evt.getKeyCode());
if ((evt.getKeyChar() >= '0' && evt.getKeyChar() <= '9') || evt.getKeyCode()==8 || evt.getKeyCode()==127|| evt.getKeyCode()==37|| evt.getKeyCode()==39) {
txtNeceye.setEditable(true);
//label.setText("");
} else {
txtNeceye.setEditable(false);
//.setText("* Enter only numeric digits(0-9)");
}
Saturday, February 4, 2012
Kalitimda metodun static olmasi
Asagidaki kullanim dogru bir kullanim cunku burada kaltim duzgun gerceklestirilmis.
public class Animal{
public void sound(){
System.out.println("Huuuuuuuu");
}
}
public class Dog extends Animal{
@Override
public void soud() {
System.out.println("Hav Hav");
}
}
Asagidaki kullanim yanlis cunku kalitimda static method override olmaz.
public class Animal{
public static void sound(){
System.out.println("Huuuuuuuu");
}
}
public class Dog extends Animal{
//Exception static method override
@Override
public void soud() {
System.out.println("Hav Hav");
}
}
public class Animal{
public void sound(){
System.out.println("Huuuuuuuu");
}
}
public class Dog extends Animal{
@Override
public void soud() {
System.out.println("Hav Hav");
}
}
Asagidaki kullanim yanlis cunku kalitimda static method override olmaz.
public class Animal{
public static void sound(){
System.out.println("Huuuuuuuu");
}
}
public class Dog extends Animal{
//Exception static method override
@Override
public void soud() {
System.out.println("Hav Hav");
}
}
Subscribe to:
Posts (Atom)