java - How to pass a String parameter to a void method? -


i need write java program course i'm taking looks genes in strand of dna.the issue having test method, need pass printallgenes(a) void printallgenes method. in test method i've tried setting 'int a' 'string a', in either case error when compiling explaining void cannot converted int or string. i'm sure obvious, i'm new programming, please pardon ignorance! thank you.

import java.io.*; import edu.duke.*;  public class findprotein {    public void test() {     string = "atg aaa tab tag atg aaa tga aat ag";     int b = printallgenes(a);     system.out.println("dna string " + a);     system.out.println("gene found " + b);   }    public void printallgenes(string dna) {     int sp = 0; //start point     while (true) {       int start = dna.indexof("atg,sp");       if (start == -1) {         break;       }       int stop = findstopindex(dna, start + 3);       if (stop != dna.length()) {         system.out.println(dna.substring(start, stop + 3));         sp = stop + 3;       } else {         sp = sp + 3;       }     }   }    public int findstopindex(string dna, int index) {     int tga = dna.indexof("tga", index);     if (tga == -1 || (tga - index) % 3 != 0) {       tga = dna.length();     }     int taa = dna.indexof("taa", index);     if (taa == -1 || (taa - index) % 3 != 0) {       taa = dna.length();     }     int tag = dna.indexof("tag", index);     if (tag == -1 || (tga - index) % 3 != 0) {       tag = dna.length();     }     return math.min(tga, math.min(taa, tag));   } } 

try use just:

 printallgenes(a);  

because printallgenes method doesn't have type of return statement.


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -