help me

0

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

mutlu_erol1905's picture
Joined: Jan 15 2018 - 9:16pm
Last seen: 1 year 5 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

mutlu_erol1905 - 1 year 5 months ago

3 Answers:

0

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

mlopez_1's picture
909
Joined: Oct 21 2013 - 8:08am
Last seen: 2 hours 27 min ago
0

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

mlopez_1's picture
909
Joined: Oct 21 2013 - 8:08am
Last seen: 2 hours 27 min ago
0

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)

 

hozawa's picture
44219
Joined: Apr 24 2010 - 4:31pm
Last seen: 1 month 6 days ago
Feedback