Tip Dönüşümleri
Integerdan String'e dönüşüm

import javax.swing.JOptionPane;
public class Main {
public static void Mesaj(String Mesaj){
JOptionPane.showMessageDialog(null, "Program Sonucu " + Mesaj, "Program Testi", JOptionPane.INFORMATION_MESSAGE);
}

public static void main(String[] args) {
String a = new String("ali");
String c = new String("veli");
String d = new String();
d = a + c; // d nin degeri "ali veli"
//System.out.println(d); Konsol çıktısı
Mesaj(d); //d string, Foksiyona string gitmeli
int e=d.length(); //e int olduğu için stringe çevrilip öyle fonksiyona yollanmalı
String f= Integer.toString(e); //integerdan stringe çevirim
Mesaj(f);
}
}
Yorumunuzu Ekleyin