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
Case Project 9-4: Troubleshoot an IP configurationYou work at a help desk and have just received a call from an employee who say
Svetllana [295]

Answer:

To get the IP address and other information on the workstation, type 'ipconfig' for windows or 'ifconfig' or Linux and press the return key.

The subnet mask is a class B type and 169.254.14.11 IP address shows that the workstation cannot access the DHCP server, so the IP address is not properly configured for network connection.

Explanation:

A computer network is an interconnection and intercommunication of two or more computer devices. All devices in a network must have an IP address, which can be static or dynamic from a DHCP server.

When a computer is configured to receive IP address from a DHCP server, but cannot reach the server, the IP address from the range of 169 is automatically assigned to it but still would not be able to communicate with other devices in the network.

4 0
2 years ago
Write a C program that displays your name and address (or if you value your privacy, a frictionless name and address)
rosijanka [135]

Answer:

Following are the program in c language

#include <stdio.h> // header file

int main() // main method

{

   char name[90]="mantasa"; // storing name

   char add[90]="120 lal bangla mumbai"; // storing address

    printf("\n Name:%s\nAddress:%s",name,add); // print name and address

   return 0;

}

Output:

Name:mantasa

Address:120 lal bangla mumba

Explanation:

In this program we are declaring the two array of char type which will store the name and address . after that we display name and address.

7 0
3 years ago
What shoul i get, Airpods or a ps4 cooling fan ???
Fynjy0 [20]

Answer:

Airpods, there is ps5 coming out

Explanation:

3 0
2 years ago
Read 2 more answers
"Write code that prints: Ready! countNum ... 2 1 Start! Your code should contain a for loop. Print a newline after each number a
BartSMP [9]

Explanation:

#include <iostream.h>

#inlcude<conion.h>

void main()

{

  int count, x;

  clrscr();

  cout<<"Enter the count:";

  cin>> count;

  cout<<"Ready!\n";

  for(x=count;x>0;x--)

  {

     cout<<x<<"\n";

  }

  cout<<"Start";

  getche();

}

This is a simple program where the output is expected to be in reverse order. So we run a for loop starting from the count and decrements the counter by 1 every time when the loop runs and print the value. So to print the output in "new line" we include "\n".

6 0
3 years ago
Lost passwords set for documents in Microsoft® Word® documents can be retrieved in the backstage view. True False
Nat2105 [25]

Answer:

True

Explanation:

Hope this helped!

3 0
2 years ago
Read 2 more answers
Other questions:
  • In pre-shared key mode, a passphrase should be at least ________ characters long.
    15·1 answer
  • The purpose of the ________ element is used to configure the main content of a web page document.
    5·1 answer
  • ____, developed by xuejia lai and james massey, is a block cipher that operates on 64-bit blocks of plaintext.
    10·1 answer
  • Why Unicode is the standard way of converting binary to text?
    8·1 answer
  • 1) which colour filter is used to pumps up black and white effects?
    13·1 answer
  • Suppose you want to view a document that has several headings. what view would you use?
    6·1 answer
  • 2. Integer plot function (find a smart way to code big integers) Write a program BigInt(n) that displays an arbitrary positive i
    8·1 answer
  • Suppose a MATV/SMATV (Satellite Master Antenna Television) firm has to start it's operation in the metropolitan area of a countr
    12·1 answer
  • A set of blocks contains blocks of heights 1,2, and 4 centimeters. Imagine constructing towers of piling blocks of different hei
    15·1 answer
  • Which type of mic is durable, versatile and does not rely on power?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!