Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

Q1. which of the following is syntactically incorrect? and Why?

int x = 5, y = x; String m1 = "ABc", m2 = m1; String m3 = new String("AbC");
a. if( x.equals(y) )

b. if( m1=m2)

c. if( m2==m3 )

d. if ( x==y )

e. if( m1=null )

f. if( m1.equals(m3) )

g. If( m1.equals(m2)


Q2. What is the output of following questions.

A.int x 5, y 0, z -2;

if(x<0 SS (y<2 II z>2) )
System. out .println("A");
else if(x>0 (y<2 II z>2))
System. out sprintln("8"):
else if(x>0 && (y<2 && z>2))
System. out .println("C");

System.out.println("D");

B.

int x = -1, y = 3, z = -2;
if(x<0 && (y<2 II z>2) )
System. out .print("A");
else if(x>0 && (y<2 II z>2))
System. out .print("8");
else if(x>0 it (y<2 && z>2))
System. out. print("C");
System.out.println("D");

C.

int i;
int sum=o; for(i=0; i<5 ;i++)
{
if(i>1)
sum=sum+i;
}
System.out.println("Sum is " + sum); System.out.println("last value of i is + i);

Q2.1

if(x>0)
{
if (yif(z==y)
System. out.println("A");
}
}
else
System.out.println("B");

Q2.2. Given the code:

what is the output in each of the following cases? a. x=6, y=0, z=0
b. x=2, y=-1, z=-2

c. x=-1, y=-2, z=-2

d. x=0, y=-2, z=-2

e. x=3, y=-1, z=-1

Q3.Convert the following for loop into a while loop.

int sum = 0;
for (int i = 10; i > 10; i--) sum = sum + I;

Q4. Write a program called CheckPass which read the mark from user in double and prints "PASS" if the mark is more than or equal to 60; or prints "FAIL" otherwise.

Java, Programming

  • Category:- Java
  • Reference No.:- M92405421
  • Price:- $35

Priced at Now at $35, Verified Solution

Have any Question?


Related Questions in Java

In ruby the hash class inherits from enumerable suggesting

In Ruby, the Hash class inherits from Enumerable, suggesting to a programmer that Hashes are collections. In Java, however, the Map classes are not part of the JCF (Java Collections Framework). For each language, provide ...

Retail price calculatorwrite a java program that asks the

Retail Price Calculator Write a JAVA program that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: (If an item's wholesale cost is 5. ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Assignment game prototypeoverviewfor this assessment task

Assignment: Game Prototype Overview For this assessment task you are expected to construct a prototype level/area as a "proof of concept" for the game that you have designed in Assignment 1. The prototype should function ...

Solving 2nd degree equationsbull write the following java

Solving 2nd degree equations • Write the following Java methods • boolean real-sols(double a, double b, double c): it returns true if the 2nd degree equation ax2 + bx + c has real solutions • double solution1(double a, d ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Part a specification - robot simulationpart a

PART A Specification - Robot Simulation PART A Requirements To complete this assignment you will use the supplied eclipse project Robot P1/. It is already set up to execute a simple arm movement loop which you will build ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Can someone kindly help me to consider whether java

Can someone kindly help me to consider whether Java provides the facility of operator overloading? If it does, may you kindly describe how overloading operators can be accomplished? If not, may you kindly describe why yo ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As