Io ho questa classe:
io facendo System.out.println(body.size) so che ha valore 24codice:class Body { String stile; String jc; String rstile; String grassetto; String italico; String sottolineato; String size; String testo; String titolopict; String formatopict; public String toString() { StringBuffer buffer = new StringBuffer(); if ( stile != null ) buffer.append("Stile body: " + stile + "\n"); if ( jc != null ) buffer.append(" Jc body: " + jc + "\n"); if ( rstile != null ) buffer.append(" Rstile body " + rstile + "\n"); if ( grassetto != null ) buffer.append(" Grassetto body " + grassetto + "\n"); if ( italico != null ) buffer.append(" Italico body " + italico + "\n"); if ( sottolineato != null ) buffer.append(" Sottolineato body: " + sottolineato + "\n"); if ( size != null ) buffer.append(" Dimensione body: " + size + "\n"); if ( testo != null ) buffer.append(" Testo body: " + testo + "\n"); if ( titolopict != null ) buffer.append(" Nome immagine body: " + titolopict + "\n"); if ( formatopict != null ) buffer.append(" Formato immagine body: " + formatopict + "\n"); return buffer.toString(); } }
se però provo a fare if(body.size=="24") il compilatore non entra nell'if, come mai???
riesco a farlo entrare solo se ho body.size con valore null facendo if(body.size==null)

Rispondi quotando