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
hoa [83]
3 years ago
8

4.6.1: Reading and outputting strings. Write a program that reads a person's first and last names, separated by a space. Then th

e program outputs last name, comma, first name. End with newline. Example output if the input is: Maya Jones Jones, Maya
Computers and Technology
1 answer:
Solnce55 [7]3 years ago
4 0

Answer:

import java.util.Scanner;

public class num5 {

   public static void main(String[] args) {

   Scanner in = new Scanner(System.in);

   System.out.println("Enter your full name");

   String name = in.nextLine();

   String [ ] n = name.split(" ");

       System.out.println(n[0]+", "+n[1]);

   }

}

Explanation:

Scanner class is used to receive the full names. e.g "Maya Jones"

This is saved in a variable called name using the nextLine() method to grab the entire line of string

The string split() method is used to split the string on the whitespace

The output statement is used to print the value at index 0 and index 1 concatenated with a comma.

You might be interested in
I am on windows 10 OS. I have been trying to figure this out for ages! I want to get my task bar (on the bottom of the screen) t
dedylja [7]
To change the orientation of your task bar, you must simply right click it>Make sure that lock taskbar is disabled>Drag your taskbar to the top of the screen>lock it again so you dont accidentally move it. Hope i have helped you!
3 0
4 years ago
Read 2 more answers
Utility software includes which of the following ? <br> Select all that apply
svet-max [94.6K]

Answer:   Utility programs, commonly referred to as just "utilities," are software programs that add functionality to your computer or help your computer perform better. These include antivirus, backup, disk repair, file management, security, and networking programs.

Explanation:

7 0
3 years ago
What will be printed when the method printstuff is called?
abruzzese [7]
Here is the correct answer of the given question above. The one that will be printed when the method printstuff is called is that there will be a compile error because a double cannot be assigned to an int <span>without a cast. Hope this answer helps. </span>
3 0
4 years ago
Which of these is a formatting option that you can use to enhance your text document?
Paha777 [63]
My best guess is the last option (D) tools. Hope it helps
8 0
3 years ago
Read 2 more answers
What is systems integration?
valina [46]

Explanation:

In engineering, system integration is process of bringing various component subsystems together into one single system and also ensuring that these subsystems function as one system together.

In information technology, it is process of linking together various computing systems and various software applications functionally or physically, to act as coordinated whole.

System integrator integrates various discrete systems utilizing variety of techniques.

7 0
4 years ago
Other questions:
  • A custom date format set for a date/time field that contains the symbols mmm/dd/yy would display the date as ____.
    12·1 answer
  • What does subscribing to a website’s RSS feed provide to a subscriber?
    10·1 answer
  • How did mark watney survive the accident
    9·1 answer
  • In the context of the planning phase of the systems development life cycle (SDLC), which is an example of an internally identifi
    6·1 answer
  • 5. RAM IS YOUR SYSTEM’S-
    14·2 answers
  • Why do we allow electronic instruments to warm-up before use?
    11·1 answer
  • Write a calculator program using a switch statement that: a) Prompts the user to enter two numbers b) Prompts the user to select
    6·1 answer
  • E-What is the important of Recycle bin?<br>Ans:​
    12·1 answer
  • Identifying the Property for Setting Page Breaks
    8·1 answer
  • Usually it is a rectangular box placeed or underneath your desk​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!