user3231871
user3231871

Reputation: 191

Syntax error on token "/", Expression expected after this token

Why am I getting this error? Syntax Error on token "/", Expression expected after this token.

 InputStream in = getResources().openRawResource(R.raw.msgn);
 FileOutputStream out = new FileOutputStream(media/audio/notifications/); // Error is in this line
                    byte[] buff = new byte[1024];
                    int read = 0;

                    try {
                       while ((read = in.read(buff)) > 0) {
                          out.write(buff, 0, read);
                       }
                    } finally {
                         in.close();

                         out.close();

Upvotes: 0

Views: 758

Answers (3)

SMR
SMR

Reputation: 6736

you forgot the quotes do this:

new FileOutputStream("media/audio/notifications/");

Upvotes: 0

Hamid Shatu
Hamid Shatu

Reputation: 9700

You mus put media/audio/notifications/ in double-quote and pass them in a File constructor, since FileOutputStream() expects a File to pass in...

FileOutputStream out = new FileOutputStream(new File("media/audio/notifications/"));

Upvotes: 0

Blackbelt
Blackbelt

Reputation: 157457

he is expecting a string. You need double quote

"media/audio/notifications/"

Upvotes: 5

Related Questions