Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    [java] Conversione da stringha a intero

    Qualcuno sa dirmi il codice java per convertire una stringa, ad esempio "23" in un intero?

  2. #2
    Utente di HTML.it L'avatar di Corwin
    Registrato dal
    Jan 2002
    Messaggi
    584
    int i = Integer.parseInt(Stringa);
    I don't wanna have to shout it out / I don't want my hair to fall out
    I don't wanna be filled with doubt / I don't wanna be a good boy scout
    I don't wanna have to learn to count / I don't wanna have the biggest amount
    I don't wanna grow up

  3. #3
    int num = Integer.parseInt("23");

    Questo metodo può lanciare un'eccezione del tipo NumberFormatException se la stringa passata come parametro non è corretta.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.