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
erica [24]
3 years ago
12

Write a java program that will take 2 String inputs and perform the following operation on them: a) Show length of the strings b

) Concatenate two strings c) Convert those two strings to uppercase.
Computers and Technology
1 answer:
marissa [1.9K]3 years ago
6 0

Answer:

// here is code in java.

import java.util.*;

// class definition

class Solution

{

   // main method of the class

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

{

   try{

 // scanner object to read input from user

Scanner scr=new Scanner(System.in);

 // string variables

String st1,st2;

System.out.print("enter the first string:");

 // read the first string

st1=scr.nextLine();

System.out.print("enter the second string:");

 // read the second string

st2=scr.nextLine();

// part (a)

 // find length of each string

System.out.println("length of first string is: "+st1.length());

System.out.println("length of second string is: "+st2.length());

//part(b)

 // concatenate both the string

System.out.print("after Concatenate both string: ");

System.out.print(st1+st2);

// part(c)

 // convert them to upper case

System.out.println("first string in upper case :"+st1.toUpperCase());

System.out.println("second string in upper case :"+st2.toUpperCase());

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read two strings st1 and st2 with scanner object.In part a, find the length of each string with the help of .length() method and print the length.In part b, concatenate both the string with + operator.In part c, convert each string to upper case with the help of .toUpperCase()  method.

Output:

enter the first string:hello

enter the second string:world!!

length of first string is: 5

length of second string is: 7

after Concatenate both string: hello world!!

first string in upper case :HELLO

second string in upper case :WORLD!!

You might be interested in
Three homework questions I can't figure out, please help?
Burka [1]

It A

iT b

YOU CANT TRY THE TWO ONE THE WHO ARE WRITE

8 0
2 years ago
Percentage-wise, which renewable energy source is used most?
Natasha2012 [34]
C)Hydroelectric I believe.
5 0
3 years ago
In case of a suspected data breach, what course of action should a chief information security officer (CISO) take
guapka [62]

Answer

1. Assemble his team

2. Find reason for breach

3. Evaluate what was lost

4. Ensure password change

Explanation:

In case of a suspected breach, the Chief information security officer should first of all assemble his incidence response team. This team should have representatives from all areas of the organization.

Then the reason for the breach and how access was gained has to be found out. An evaluation of what has been lost in the breach would be carried out and it's likely impact on the company.

In case credentials were stolen the CISO has to ensure that the employees change passwords. Also he has to notify all the necessary parties about the breach.

The CISO has to ensure that all employees are trained properly on security and they comply to security policies.

7 0
3 years ago
The _______ is a small program run by a computer when first powered on. its primary function is to stabilize the machine and dev
tigry1 [53]
Hello <span>TheCelloAlex1645 </span>

Answer: <span>The BIOS is a small program run by a computer when first powered on. its primary function is to stabilize the machine and devices on the motherboard so that the operating system can be loaded and take control of the computer.


Hope this helps
-Chris</span>
3 0
3 years ago
Explain demand paging with a proper example
julia-pushkina [17]
<h2><em><u>Demand</u></em><em><u> </u></em><em><u>paging</u></em><em><u> </u></em><em><u>:</u></em></h2>

<h3><em>In computer operating systems, demand paging (as opposed to anticipatory paging) is a method of virtual memory management. In a system that uses demand paging, the operating system copies a disk page into physical memory only if an attempt is made to access it and that page is not already in memory (i.e., if a page fault occurs). It follows that a process begins execution with none of its pages in physical memory, and many page faults will occur until most of a process's working set of pages are located in physical memory. This is an example of a lazy loading technique.</em></h3>

<h3 />

6 0
3 years ago
Other questions:
  • If you use the ___ template, as opposed to a formatted theme, you must make all design decisions?
    15·1 answer
  • A _____ is a machine that changes information from one form into another.
    7·1 answer
  • Please help me with these questions
    5·1 answer
  • When assembling a desktop computer you should always install the drives before the motherboard?
    9·1 answer
  • This week you will learn about basic code structure. The term structure, as it relates to programming, refers to the decisions y
    14·1 answer
  • Please help me ASAP! Here is the question.
    15·1 answer
  • The cutting tool that has a zig zag edge is called a?
    9·1 answer
  • Yeah help me please......................
    9·1 answer
  • I figured out the secret message in Dad feels good, I can connect the dots
    8·1 answer
  • Type of Factor Beginning Frog Count Simulation 1 (Low) Simulation 2 (High)
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!