Java Defteri
Java Geliştirme Bloğu
2 Ocak 2013 Çarşamba
Recursive Yineleme Metodları
static int faktoriyel(int a)
{
int t;
if(a==1 || a==0)
{
return 1;
}
int k;
int c=1;
//recursive metodu
k=faktoriyel(a-1);
c=a*k;
System.out.println(k+" a: "+a);
return c;
}
30 Eylül 2012 Pazar
Java Date Değişkenini String e Çevirme
Date i String e çevirmek için try catch kullanmalıdır.
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
try {
Date today = df.parse("20/12/2005");
jLabel1.setText("Today = " + df.format(today));
} catch (ParseException e) {
e.printStackTrace();
}
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
try {
Date today = df.parse("20/12/2005");
jLabel1.setText("Today = " + df.format(today));
} catch (ParseException e) {
e.printStackTrace();
}
Kaydol:
Kayıtlar (Atom)
Related Posts
loading..