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...

  • 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. 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...

  • 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= _________

  • 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.

  • 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...

  • 5. Which one of the following statements declares a c-string variable? a.char c; b. string s;...

    5. Which one of the following statements declares a c-string variable? a.char c; b. string s; c. char c[10]; d.string s[10]; 6. ________________ function returns the uppercase version of expression. a. tolower(expression); b. upper(expression) c. toupper(expression); d. isupper(expression); 7. Which of the following creates a string object with data ‘csci-1410’? a. string str; b. string ‘csci-1410’; c. string s("csci-1410"); d. string s(csci-1410);

  • You are given a boolean expression consisting of a string of the symbols 'true', 'false', and', 'or', and 'xor'.

    [III.4] You are given a boolean expression consisting of a string of the symbols 'true', 'false', and', 'or', and 'xor'. Count the number of ways to parenthesize the expression such that it will evaluate to true. For example, there is only 1 way to parenthesize 'true and false xor true' such that it evaluates to true. Complete the following tasks.  [III.4a] Show the parenthesization of the example such that evaluate to true.   'true and false xor true' [III.4b] Show the optimal substructure...

  • 6. Solve for x log2 (x + 7) + log 2x-3. a) x+7=3 b) 1 c)...

    6. Solve for x log2 (x + 7) + log 2x-3. a) x+7=3 b) 1 c) not possible x d) none of these 7. Evaluate log, a) x b) c) not possible d) none of these 8. What is the solution of -764? a) -2 b) 0 c) 2 d) 10 9. Find the approximate value of the expression log 16 160 a) 0.54 b) 1.83 c) 2.20 d) 0.9 10. Find the value of the expression 2.5 b) 12.2...

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
ADVERTISEMENT