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
Mariulka [41]
3 years ago
5

Write a statement that declares a PrintWriter reference variable named output and initializes it to a reference to a newly creat

ed PrintWriter object associated with a file named "output.txt".
Computers and Technology
1 answer:
dusya [7]3 years ago
5 0

Answer:

PrintWriter variable = new PrintWriter("output.txt");

Explanation:

There are two ways of declaring a reference variable in programming.

One way is

Reference Variable-name = new Reference ("some texts here");

While the other is

Reference Variable-name;

Variable-name = new Reference ("some texts here");

Both ways are valid ways of reference variable declaration.

In the question above, the reference is PrintWriter, it points to output.txt and the question says "write a single statement";

Hence, we make use of

PrintWriter variable = new PrintWriter("output.txt");

A reference variable is declared to be of a specific type and that type can never be changed.

You might be interested in
What is a database query?
lana [24]
C.a form used to create a new tables for the database
8 0
2 years ago
Read 2 more answers
Many people use relative location on a daily basis by using __________. A.
kkurt [141]
Many people use relative location on a daily basis by using B) their mental maps of an area.
You know what a certain area looks like, at least approximately, so you don't need to use these other options on a day to day basis. You can rely on your mental maps to do the work for you.
6 0
3 years ago
Write a program that checks whether a positive number given by an input from the user is greater than 5 and less than 20 with ja
Alona [7]

Answer:

Program written in Java is as follows

See comments for explanations

import java.util.Scanner;

public class CheckRange {

public static void main (String [] args)

{

// This line allows the program accept user input

Scanner input = new Scanner(System.in);

//This line declares variable for user input

int num;

//This line prompts user for input

System.out.print("Number: ");

//This line gets user input

num = input.nextInt();

/* The following if statement checks if the user input is greater than 5 and less than 20 */

if (num > 5 && num <= 20)

{

/* This line is executed if the above condition is true */

System.out.print(num+" is greater than 5 and less than 20");

}

else

{

/*If the condition is not true, this line is executed*/

System.out.print(num+" is not within specified range");

}

// The if condition ends here

}

}

5 0
3 years ago
True or false As the contents and topics of new magazines change year-to-year, you can see various trends and movements across s
Tamiku [17]

the short answer is true.

The long answer is that magazines can help shape and invent new trends.  like they have time and time again in the past.

Hope this helps

-scav

8 0
2 years ago
Write a C++ program that reads from the standard input and counts the number of times each word is seen. A word is a number of n
Rufina [12.5K]

Answer:

#include <stdio.h>

#include <string.h>

#include <ctype.h>

 

struct detail

{

   char word[20];

   int freq;

};

 

int update(struct detail [], const char [], int);

 

int main()

{

   struct detail s[10];

   char string[100], unit[20], c;

   int i = 0, freq = 0, j = 0, count = 0, num = 0;

 

   for (i = 0; i < 10; i++)

   {

      s[i].freq = 0;

   }

   printf("Enter string: ");

   i = 0;

   do

   {

       fflush(stdin);

       c = getchar();

       string[i++] = c;

 

   } while (c != '\n');

   string[i - 1] = '\0';

   printf("The string entered is: %s\n", string);

   for (i = 0; i < strlen(string); i++)

   {

       while (i < strlen(string) && string[i] != ' ' && isalnum(string[i]))

       {

           unit[j++] = string[i++];

       }

       if (j != 0)

       {

           unit[j] = '\0';

           count = update(s, unit, count);

           j = 0;

       }

   }

 

   printf("*****************\nWord\tFrequency\n*****************\n");

   for (i = 0; i < count; i++)

   {

       printf("%s\t   %d\n", s[i].word, s[i].freq);

       if (s[i].freq > 1)

       {

           num++;

       }

   }

   printf("The number of repeated words are %d.\n", num);

 

   return 0;

}

 

int update(struct detail s[], const char unit[], int count)

{

   int i;

 

   for (i = 0; i < count; i++)

   {

       if (strcmp(s[i].word, unit) == 0)

       {

           s[i].freq++;

 

           return count;

       }

   }

   /*If control reaches here, it means no match found in struct*/

   strcpy(s[count].word, unit);

   s[count].freq++;

 

   /*count represents the number of fields updated in array s*/

   return (count + 1);

}

4 0
3 years ago
Other questions:
  • true or false manual handling of materials accounts for the primary source of energy in the workplace
    13·2 answers
  • The domain in an email message tells you the
    8·1 answer
  • You are trying to troubleshoot a desktop power supply issue using a voltmeter. Which of the following options are the MOST commo
    6·1 answer
  • Who invented the speaker?
    14·2 answers
  • As u type where does excel display the entry
    10·1 answer
  • Use the Date object and the Array object to determine and diplay information about the current date on your webpage. Your output
    11·1 answer
  • An office uses an application to assign work to its staff members. The application uses a binary sequence to represent each of 1
    9·1 answer
  • Zara wants to create some lines of code that are ignored by the computer. What should these lines begin with?
    5·1 answer
  • A customer wants to increase his storage capacity by 25gb
    7·1 answer
  • Which of the following are safety guidelines when socializing online?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!