java - Error Expected int but given string -


i'm getting error. it's saying it's expecting int, i'm giving string. i'm not sure how fix this.

int dnastrandlength, stranddna;         scanner dnainfo = new scanner (system.in);      system.out.println ("please enter dna strand!");         stranddna = dnainfo.next();         dnastrandlength = stranddna.length();  

you have declare stranddna string.

int dnastrandlength; string stranddna; scanner dnainfo = new scanner (system.in);  system.out.println ("please enter dna strand!"); stranddna = dnainfo.next(); dnastrandlength = stranddna.length();  

if reading int have nextint() scanner.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -