help me
Posted on January 24, 2018 at 10:40pm
type mismatch: cannot convert from void to object I am getting a error when I load a program with jar file but I can not transfer it to jaspersoft I have installed the jar file How can I fix the type mismatch error
Joined: Jan 15 2018 - 9:16pm
Last seen: 5 years 1 month ago
Posted on January 24, 2018 at 10:50pm
The problem seems to be: ' type mismatch: cannot convert from void to object '.
But is few information to fix the problem.
Something in somewhere is trying to convert a void method to object.
Mariano
Joined: Oct 21 2013 - 8:08am
Last seen: 2 weeks 1 day ago
Posted on January 25, 2018 at 12:19am
Suppose that you use ' static void SayiyiYaziyaCevir(String s) ' in somewhere where expect to be returned an object value.
A void method does not return nothing.
Mariano
Joined: Oct 21 2013 - 8:08am
Last seen: 2 weeks 1 day ago
Posted on January 25, 2018 at 7:44pm
The problem with your code is that you probably do not know Java. The problem is with the following line. Are you trying to define a constructor with 1 argument or are you trying to define a method? If a constructor, there shouldn't be a "void". If you are trying to define a method, use a name different from the class name.
static void SayiyiYaziyaCevir(String s)
Joined: Apr 24 2010 - 4:31pm
Last seen: 3 years 9 months ago
import javax.swing.JOptionPane;
public class SayiyiYaziyaCevirme {
public static void main(String[] args)
{
SayiyiYaziyaCevir(args[0]);
}
static void SayiyiYaziyaCevir(String s)
{
Float say;
Integer birler, onlar, yuzler, binler, onbinler, yuzbinler, onlarr, birlerr;
s = String.valueOf(s);
say = new Float(Float.valueOf(s));
int sayi=(int)Math.floor(say);
int sayii = (int)Math.floor((say-sayi)*100.00f);
onlarr = sayii % 10;
birlerr = (sayii / 10) % 10;
birler = sayi % 10;
onlar = (sayi / 10) % 10;
yuzler = (sayi / 100) % 10;
binler = (sayi / 1000) % 10;
onbinler = (sayi / 10000) % 10;
yuzbinler = (sayi / 100000) % 10;
String[] birlik = { "", "Bir", "İki", "Üç", "Dört", "Beş", "Altı", "Yedi", "Sekiz",
"Dokuz" };
String[] onluk = { "", "On", "Yirmi", "Otuz", "Kırk", "Elli", "Altmış", "Yetmiş",
"Seksen", "Doksan" };
String[] yuzluk = { "", "Yüz", "İkiyüz", "Üçyüz", "Dörtyüz", "Beşyüz", "Altıyüz",
"Yediyüz", "Sekizyüz", "Dokuzyüz" };
String[] binlik = { "Bin", "Bin", "İkibin", "Üçbin", "Dörtbin", "Beşbin", "Altıbin",
"Yedibin", "Sekizbin", "Dokuzbin" };
String[] onbinlik = { "", "On", "Yirmi", "Otuz", "Kırk", "Elli", "Altmış",
"Yetmiş", "Seksen", "Doksan" };
String[] yuzbinlik = { "", "Yüz", "İkiyüz", "Üçyüz", "Dörtyüz", "Beşyüz", "Altıyüz",
"Yediyüz", "Sekizyüz", "Dokuzyüz" };
String[] birlikk ={ "", "Bir", "İki", "Üç", "Dört", "Beş", "Altı", "Yedi", "Sekiz",
"Dokuz" };
String[] onlukk = { "", "On", "Yirmi", "Otuz", "Kırk", "Elli", "Altmış", "Yetmiş",
"Seksen", "Doksan" };
System.out.println(yuzbinlik[yuzbinler]+" "+onbinlik[onbinler]+" "+binlik[binler] + " " + yuzluk[yuzler] + " " + onluk[onlar] + " " +
birlik[birler]+" TL "+onlukk[birlerr]+" "+birlikk[onlarr]+" kr ");
}
}
the content of the jar file