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
ipn [44]
3 years ago
12

Given the string variables name1 and name2, write a fragment of code that assigns the larger of the two to the variable first (a

ssume that all three are already declared and that name1 and name2 have been assigned values).
Computers and Technology
1 answer:
ArbitrLikvidat [17]3 years ago
3 0
To screw with your teacher:

first = (name1 > name2 ) ? name1 : name2;

That code is correct, but your teacher is probably looking for:

if( name1 > name2 )
    first = name1;
else
    first = name2;

I love the ternary operator!

You might be interested in
1. Write an application that prompts the user to enter the size of the side of a square, and then displays a hollow square of th
belka [17]

Answer:

import java.util.Scanner;

public class HollowSquare

{

public static void main(String args[])

{

Scanner scan = new Scanner(System.in);

int size;

System.out.print("Enter the size : ");

size = scan.nextInt();

if(size>=1 && size<=20)

{

for(int i=0; i<size; i++)

{

for(int j=0; j<size; j++)

{

if(i==0 || j==0 || i==size-1 || j==size-1)

System.out.print("*");

else

System.out.print(" ");

}

System.out.println();

}

}

else

System.out.println("Invalid size.");

}

}

4 0
3 years ago
Sharon has just invented a new tractor that will plow and plant a new hybrid of corn at the same time. Which type of engineer is
Alex_Xolod [135]

she has to be A......


8 0
3 years ago
How to mark someone's answer brainiest?
saul85 [17]

there has to be more than one answer, then click mark as the brainiest

6 0
3 years ago
What are the different categories of a computer
Lorico [155]

Answer:Computer is a machine that can be program to manipulate the symbols.

Explanation:There are five different categories of a computer.

(1)super computer (2) mainframe (3) personal computer (4) workstation

(5) minicomputer

(1)super computer: super computer is the term fastest computer available current time.super computers are very expensive and specialized computer.

(2)mainframe : mainframe computer is perform to the execute the program the currently.

(3) personal computer: The most popular use for personal computer playing games and surfing internet.

(4)workstation: This type of computer used for the engineer applications desktop publishing , software development.

(5)minicomputer: The general a minicomputer is multiprocessing system it is a midsize computer.

6 0
3 years ago
To properly care for your computer, you should
BartSMP [9]
C because it’s not the other 3
7 0
4 years ago
Read 2 more answers
Other questions:
  • A network administrator is implementing multifactor authentication for employees who travel and use company devices remotely by
    14·1 answer
  • Which of the following represent features of
    6·1 answer
  • A virus that propagates using the internet or another computer network is called __________.
    10·1 answer
  • Which of the following should NOT be done to keep people from slipping on floors? A) Have the proper absorbents in an easy-to-fi
    12·2 answers
  • If you were planning how to write a program, at what point would a flowchart be helpful? At what point would pseudocode be helpf
    7·1 answer
  • Which of the following are advantages of a local area network, as opposed to a wide area network? Select 3 options.
    8·1 answer
  • What is the difference between word processing software and presentation software​
    9·1 answer
  • The illustration shows different types of text language.
    5·2 answers
  • *please be serious and also answer everything * <br> I will also mark you brainliest :)
    6·1 answer
  • Trademarks _____.
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!