Write Java code segment which prints “YES” when the names contained in two String variables name1 and name2 are the same, and “NO” if they are different.
package lecture;
import java.util.*;
public class Stringequal {
public static void main(String[] args) {
// TODO Auto-generated method
stub
Scanner sc=new
Scanner(System.in);
System.out.println("enter first
name ");
String name1=sc.nextLine();
System.out.println("enter second
name");
String name2=sc.nextLine();
if(name1.equals(name2))
System.out.println("yes");
else
System.out.println("no");
}
}

DON'T FORGET TO LIKE.
THANKS BY
HEART.
Write Java code segment which prints “YES” when the names contained in two String variables name1...
Write a JAVA program that has a method which accepts a string and prints it back to the user with all vowels replaced with *'s (multiple asterisks not '*s') with a new line after the string. The method signature should look like this: public static void replacePrint(String input)
Language is Java! Write a class named Book that has two public String variables named title, and author. Do not add or change any other code.
Keep in mind this a intro java class
2. Assuming firstNum and secondNum are integer variables that have been declared and initialized, write a code segment that prints "The product of the numbers is negative", "The product of the numbers is positive" or "The product of the numbers is zero", when their product is negative, positive or zero, respectively. The code segment should evaluate between one and four Boolean expressions to give the correct output. Give values for firstNum and...
Write a JAVA program that has 2 methods with the same name: printCaps(String input) prints the input in capital letters, printCaps(String input, int num) prints in capital letters the specified number of times on a new line: public static void printCaps(String input) public static void printCaps(String input, int num)
Write a JAVA code snippet which prints out numbers between 0 and 1,000,000, BUT only print the numbers which are a multiple of 3.
[JAVA] Suppose we need to write code that receives String input from a user, and we expect the String input to contain a double value (inside quotes). We want to convert the String to a double using the static method Double.parseDouble(String s) from the Double class. The parseDouble method throws a NumberFormatException if the String s is not a parsable double. Write a method printSum that takes two String parameters (that hopefully have parsable doubles in them), and either prints...
Write Java code that prompts the user to enter his or her full name, then prints the name in reverse order (i.e., last name, first name). Read an entire line as a single string. Here is an example dialogue with the user: Please enter your full name: Sammy Jankis Your name in reverse order is Jankis, Sammy
use java and write in text
a. Rewrite the following code segment using if statements. Assume that grade has been declared as of type char. char grade= 'B';; switch (grade) { case 'A': System.out.println("Excellent"); break case 'B': System.out.println("Good"); default: System.out.println("you can do better”); } - b. write Java code that inputs an integer and prints each of its digit followed by ** e.gif the integer is 1234 then it should print 1**2**3**4 e.g. if the integer is 85 then it...
Python Write code which prints "smile" when the variable happy is True.
Using Python The variables x and y refer to numbers. Write a code segment that prompts the user for an arithmetic operator and prints the value obtained by applying that operator to x and y. Using the following information run an example in Python Idle op = input("Enter an arithmetic operator: ") if op == "+": print(x + y) elif op == "-": print(x – y) elif op == "*": print(x * y) elif op == "/":...