Question

Given the following declaration: String s = "Apples and bananas are yummy."; Evaluate the expression: s.indexOf("a")...

Given the following declaration: String s = "Apples and bananas are yummy.";
Evaluate the expression: s.indexOf("a")

Possible Answers:

10

-1

none of these

0

12

7

8

11

9

0 0
Add a comment Improve this question Transcribed image text
Answer #1

OUTPUT : 7

class Test
{
   public static void main (String[] args)
   {
       String s = "Apples and bananas are yummy.";
       System.out.println(s.indexOf("a"));
   }
}

Add a comment
Know the answer?
Add Answer to:
Given the following declaration: String s = "Apples and bananas are yummy."; Evaluate the expression: s.indexOf("a")...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Short Answer Given the following class declaration for a binary string/integer pair (the binary n...

    ANSWER IN C++ Constructors Short Answer Given the following class declaration for a binary string/integer pair (the binary number, in the form of a string. should be the binary form of the integer): class binint public: int num; // Note this is an address! string *bin; // Note that this is an address! binint (int n); binint (string s); void convertitos(int n); void convertstoi(string s); II NOTE: you do not have to do anything // with this method you can...

  • Question 7 0 out of 10 points Consider the following table Country A Country B Bananas...

    Question 7 0 out of 10 points Consider the following table Country A Country B Bananas Apples Numbers denote hours to produce 1 unit 4 What are the world's per-unit gain for bananas if Country A and B specialize according to their absolute advantage? What are the world's per-unit gain for apples if Country A and B specialize according to their absolute advantage? In order to answer, ask yourself: (1) Who the absolute advantage at what? (2) If Country A...

  • The following expression is a postfix string for an arithmetic expression. 16 | -2 | 4...

    The following expression is a postfix string for an arithmetic expression. 16 | -2 | 4 | * | 21 \ 17 \ - | / | 9 | + | 7 | 5 | + But it contains one or more errors. Identify the error(s) and provide your own correction, which should be as simple as possible. Then produce the equivalent expression in infix form base on your correction. (The vertical bars serve only to separate the items in...

  • C# 1.)Using the following declaration: int [ , ] exampleArray = {{3, 5, 6, 7}, {2,...

    C# 1.)Using the following declaration: int [ , ] exampleArray = {{3, 5, 6, 7}, {2, 8, 9, 22}, {1, 0, 4, 11}}; ______________ would be displayed if the following output statement was executed. WriteLine(exampleArray.Rank); 2.)Using the following declaration: int [ , ] exampleArray = {{3, 5, 6, 7}, {2, 8, 9, 22}, {1, 0, 4, 11}}; ______________ would be displayed if the following output statement was executed. WriteLine(exampleArray[0, 2]); 3.) Using the following declaration: int [ , ] exampleArray...

  • 3) Evaluate the following expression and put answer in POT and Standard form -or it is...

    3) Evaluate the following expression and put answer in POT and Standard form -or it is not correct— a) (4x10+3) / (2x10+2)= _________ b) (4x10+12)/ (2x10-2)= _________ c) (3x10-8)/ (9x10+7)= _________ d) (10-8)/ (10-21)= _________ e)(10+4) * (10+38)= _________ f) (6x10+8) * ((2x10+12)/ 3x10+15))= _________ g)(2x10+1)* (3x10-5) * (1.5x10-8)= _________ h)(3x10-2) / (10+5 * 10+7)= _________ i)(2.1x10+17)/((0.7x10+12) * (6.0x10+5))= _________ j)(10+7)8= _________ k)(10+17)3/(10+4)15= _________

  • 3. Craig likes both apples and bananas. He consumes nothing else. The consumption bundle where Craig...

    3. Craig likes both apples and bananas. He consumes nothing else. The consumption bundle where Craig consumes x, bushels of apples per year and Xg bushels of bananas per year is written as (X4, Xg). Last year, Craig consumed 20 bushels of apples and 5 bushels of bananas. It happens that the set of consumption bundles (XA, Xg) such that Craig is indifferent between (XA, Xg) and 0,5) is the set of all bundles such that Xg = 100/XA. The...

  • Given the following expression, Draw the expression tree? X – Y / (Z % 10 –...

    Given the following expression, Draw the expression tree? X – Y / (Z % 10 – 1) + Y – Z Use the expression tree to evaluate the expression for: Z = 110 Y = 110 X = 12

  • Suppose that in the market for apples, demand and supply are given by the following functions:...

    Suppose that in the market for apples, demand and supply are given by the following functions: LaTeX: D: Q^{D}=65-5P D : Q D = 65 − 5 P S: Q^{S}=(-8)+5P S : Q S = ( − 8 ) + 5 P 1.) The equilibrium price in the market is $ . 2.) The equilibrium quantity in this market apples. 3.) At P=9.5 P = 9.5 , there is a surplus of apples.

  • 7. Given two strings char s1[??] = “first string” and s2[??] = “second string”. 7.1. How...

    7. Given two strings char s1[??] = “first string” and s2[??] = “second string”. 7.1. How much storage should be declared for each of the strings? 8. What would the function strlen(“today is Wednesday”); return? 9. Given a byte in 2’s complement What is 0x56 in decimal? a) -13 b) −110 c) 38 d) 67 e) none of the above 10. Given a six bit integer in 2’s complement What is 100100 in decimal? a) -28 b) −24 c) -36...

  • please simplify Problem 2.3 Evaluate or simplify the following integrals or expression as much as possible...

    please simplify Problem 2.3 Evaluate or simplify the following integrals or expression as much as possible (show your work). (a) L, 8(t)x(t – 1)dt (e) , 8(at)dt (i) cos(10zt) [8(t) + 8(t + 5)] sin (b) 8(t – T)x(t)dt (f) 8(2t – 5) sin nt dt (c) L 8(t)x(r – t)dt cos (x - 5)|6(x – 3)dx (sin ke (B) e*-2 8(w) (k) 6(r – t)x(t)dt (d) (h) Jt-11 t+9 8(1 – 3)đr Problem 2.3 Evaluate or simplify the following...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT