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
andrew11 [14]
3 years ago
12

Suppose we have a String object called myString. Write a single line of Java code

Computers and Technology
1 answer:
VikaD [51]3 years ago
5 0

Answer:

myString=myString.toUpperCase();

Explanation:

In java to change all characters of a string to upper case we use .toUpperCase() method.It will convert string to upper case.

Implementation in java.

import java.util.*;

class Solution

{

public static void main (String[] args) throws java.lang.Exception

{

   try{

Scanner scr=new Scanner(System.in);

System.out.print("Enter a string:");

String myString=scr.nextLine();

myString=myString.toUpperCase();

System.out.println("string in upper case : "+myString);

         }catch(Exception ex){

       return;}

}

}

Output:

Enter a string:hello

string in upper case : HELLO

You might be interested in
Task1: #Define a function called show_students which takes 2 parameters students and message #Print out a message, and then the
k0ka [10]

Answer:

  1. def show_students(message, sList):
  2.    print(message)
  3.    print(sList)
  4.    print("Our students are currently in alphabetical order")
  5.    sList.sort()
  6.    output = ""
  7.    for student in sList:
  8.        output += "-" + student
  9.    print(output)
  10.    print("Our students are currently in reverse alphabetical order")
  11.    sList.sort(reverse=True)
  12.    output = ""
  13.    for student in sList:
  14.        output += "-" + student
  15.    print(output)  
  16. show_students("Welcome to new semester!", ["Aaron","Bernice", "Cody"])

Explanation:

Firstly we declare a function that will take two inputs, message and student list (Line 1).

In the function, we first print the message and the original input student list (Line 2 - 3). Next, we use sort method to sort the input list and then output the sorted items from the list using a for loop (Line 5-10).

Next, we sort the list again by setting reverse = True and this will sort the list in descending order (Line 13). Again we use the similar way mentioned above to output the sorted items (in descending order) using a for loop (Line 14 -17)

We test the function using a sample student list (Line 18) and we shall get the output:

Welcome to new semester!

['Aaron', 'Bernice', 'Cody']

Our students are currently in alphabetical order

-Aaron-Bernice-Cody

Our students are currently in reverse alphabetical order

-Cody-Bernice-Aaron

6 0
3 years ago
Alan wants to buy camera support equipment that would provide mechanical support to his camera and which could also store extra
Andru [333]

Answer:

Could it be tripod?

Explanation:

If you did this question do you remember what the answer was?

4 0
3 years ago
What are html documents also called?
11Alexandr11 [23.1K]
HyperText Markup Language
4 0
3 years ago
What would happen if the bitmap or free list containing the information about free disk blocks was completely lost due to a cras
masha68 [24]

Answer:

It can be repaired with disk utility / recovery algorithms

In UNIX it can be done by scanning

In FAT file scan the FAT looking for free entries

Explanation:

When the crash happens, it is not a problem for UNIX and FAT file system

It can be repaired with disk utility/recovery algorithms.

The recovery algorithm is a list of all blocks in all files and takes a compliment as new free file.

In UNIX scanning can be done at all I-nodes.

In FAT file problem cannot occur because there is no free list .If there was any problem than it would have to be done to recover it to scan the FAT looking for free entries.

7 0
4 years ago
Given a constant named size with a value of 5, which statement can you use to define and initialize an array of doubles named ga
Vinil7 [7]

Answer:

all of the above

7 0
3 years ago
Other questions:
  • A company's computers monitor assembly lines and equipment using ________ communications.
    6·1 answer
  • What is a Network-layer routing technology that enables a group of workstations to share a single registered address?
    5·1 answer
  • Which is NOT a type of SD card?
    8·2 answers
  • Describe a scenario for which a find unmatched query could be used.
    12·1 answer
  • 8. How can you prevent your VMs receiving DHCP server messages from unauthorized virtual machine pretending to be DHCP servers?
    6·1 answer
  • Please I need this answer now.<br>this is the fill in the blanks​
    14·1 answer
  • Two methods defined within a class are shown below. What can be said about the variable x used in both methods?
    10·1 answer
  • Amanda needs to create an informative print brochure for her local library’s fundraiser dinner. What critical detail must she ha
    9·1 answer
  • WHY IS BRAINLY NOTIFICATIONS LIKE THIS?????
    15·2 answers
  • In the software development process, which review studies the software design before it is released for coding?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!