1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Dima020 [189]
3 years ago
8

java class What is the output of the following JAVA program (Java assumes public if no access modifier is given)? class Test { p

ublic static void main(String[] args) { Test obj = new Test(); obj.start(); } void start() { String stra = ""do""; String strb = method(stra); System.out.print("": ""+stra + strb); } String method(String stra) { stra = stra + ""good""; System.out.print(stra); return"" good""; } }
Computers and Technology
1 answer:
Natasha2012 [34]3 years ago
6 0

Answer:

The answer to the given question is it will produce an "error"  

Explanation:

In the given java program it will produce an error because in java we do not use double quote("""") for message printing. We use a single quote("") for message printing. In the given program if we use a single quote(""). so it will give output that is "dogood:dogood".

The correct program to this question is can be given as:

Program:

public class Test  //define a class test.

{

   public static void main(String[] args)  //define main method

   {

       Test obj = new Test();   //create class object  

       obj.start(); //calling function

   }  

   void start()  //define function start.  

   {

       String stra = "do";   //define variable and assign value.

       String strb = method(stra);  //define variable and pass stra variable in method() function as a parameter.

       System.out.print(":"+stra + strb); //print value.  

   }

   String method(String stra)  //define function method  

   {  

       stra = stra + "good";   //add value

       System.out.print(stra);  //print value of stra

       return"good";  //return value

   }

}

Output:

dogood:dogood

You might be interested in
Write only in C, not C++.
yawa3891 [41]

Answer:

#include <iostream>

using namespace std;

int main() {

  int k;

double d;

string s;

cin >> k >> d >> s;

cout << s << " " << d << " " << k << "\n" << k << " " << d << " " << s; }

                                                                   

Explanation:

k is int type variable that stores integer values.

d is double type variable that stores real number.

s is string type variable that stores word.

cin statement is used to take input from user. cin takes an integer, a real number and a word from user. The user first enters an integer value, then a real number and then a small word as input.

cout statement is used to display the output on the screen. cout displays the value of k, d and s which entered by user.

First the values of k, d and s are displayed in reverse order. This means the word is displayed first, then the real number and then the integer separated again by EXACTLY one space from each other. " " used to represent a single space.

Then next line \n is used to produce a new line.

So in the next line values of k, d and s are displayed in original order (the integer , the real, and the word), separated again by EXACTLY one space from each other.

The program along with the output is attached.

7 0
3 years ago
Suppose that a laptop identifies its processor as follows: AMD’s A84500M. What does the AMD represent?
zalisa [80]

Answer:

Advanced Micro Devices

Explanation:

4 0
2 years ago
Web beacons are tiny, invisible software programs hidden in email messages and web pages that are used to track and report a use
Umnica [9.8K]

Answer:

The answer is "True".

Explanation:

The web beacons are one of the different techniques, that are used on web pages and emails, to check whether a user has access to some unobtrusively. It is a line, that is often invisible, and typically does not exceed 1 pixel.

  • It is usually used with cookies.
  • It is also known as a small graph, which generates a request to the server for tracking service.
7 0
3 years ago
Which fund classification would a focus on only stocks of technology companies match?
Bumek [7]

Answer:

Growth funds

Explanation:

This funds fucos on capital appreciation

5 0
3 years ago
Edhesive unit 4 test
sergij07 [2.7K]

Answer:

padna jana ta yarrr kasto this yarr

8 0
2 years ago
Other questions:
  • 1. What are the biggest risks when using the public Internet as a Wide Area Network (WAN) or transport for remote access to your
    6·1 answer
  • K. What are the types of page orientation?​
    7·1 answer
  • The internet connects millions of computers connected through millions of ____ worldwide.
    9·1 answer
  • Don is visiting digital stores and searching the internet to learn about high-definition DVD players before he buys one. This is
    8·1 answer
  • What will be the values of ans, x, and y after the following statements are executed? int ans = 35, x = 50, y =50; if ( x &gt;=
    7·2 answers
  • What will be the output after the following code is executed? def pass_it(x, y): z = y**x return(z) num1 = 3 num2 = 4 answer = p
    7·1 answer
  • Which is NOT an example of a "Serious Game"?
    9·1 answer
  • WILL GIVE BRAINLIEST ANSWER!!!<br><br> How do you manage your screen time?
    8·2 answers
  • Ndcdeviceid?????????????????????​
    8·1 answer
  • Types of Hazards Mitigation Measures
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!