Java | JSP | JSF Answers

Questions: 4 418

Answers by our Experts: 3 943

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

OK so I'm relatively new to java, and I am trying to create a simple program in which it stores data about an animal, and then displays that data in viewable format. This is what I have to far.

public class HomeProject1a{
public static void main (String [] args){
String name = "Human";
int numLegs = 2;
double height = 1.8;
boolean hasTail = false;

System.out.println("The animal is a " + name);
System.out.println("A " + name + " has " + numLegs + " legs");
System.out.println("A " + name + " is " + height + " meters tall");
if (hasTail = true) System.out.println("A " + name + " has a tail");
else if (hasTail = false) System.out.println("A " + name + " doesn't have a tail");

the problem is the if and else if statements. I do not know how to make java recognise them as if statements, and if I run the program, this is the output:

The animal is a Human
A Human has 2 legs
A Human is 1.8 meters tall
A Human has a tail

any help?
please, explain these to me using simple english.


if(name.matches(userId),

String name = session.getAttribute("name"),

String prodID=request.getParameter("productID");
//int no=Interger.parseInt(prodID);
int sumcount=0;,
How can I use setLocation() from javax.swing.JFrame on a customized JButton? I have tried to use setLayout(null); but then the button disappears!
When declare variables in a class , for example : Private int num OR int num; ( without access modifier).What differences ? .And when we public methods in a same class , how can those variables preferred ?

What " constructors " usually do after declare variables .?
How to use get()/set() methods ?
What "RETURN" statement and How to use "RETURN" statement in Java when public a method or class ?
Are you able to write programming assignment? The assignment is to implement Adaboost algorithm using Java, and read a .data file as input, and produce training error and generalization errors.
Give me some example of overloading method and methods especially in iteration and can you explain briefly so that i can fully understand thank you.
I am new to JAVA ! When I am going to write a program , how can I decide how many Class I have to create ? And how can I know what members , method in each class ? What the purpose of MAIN CLASS How can Classes as well as methods connected to run my program ? With C++ before , I usually write code only on one main screen with all variables together. Thank you
How would I code this algorithm into Java to multiply to custom BigInts?
/* An Example of Algorithm (921 * 54)
* [1,2,9] <- a reversed
* [4,5] <- b reversed
* revProd = [0,0,0,0,0] <- initial revProd
* summand = [1,2,9]*4 = [4,8,6,3], revProd = [4,8,6,3,0]
* summand = (0)[1,2,9]*5 = (0)[5,0,6,4], revProd = [4,3,7,9,4]
* product = [4,9,7,3,4]
*/
My program needs to multiply two custom BigInts objects I've constructed that store their values in arrays. This is how the method starts and I know the basic algorithm but I am unsure how to convert it into code.

public BigInt times(BigInt other) { //multiply two BigInts
BigInt result = new BigInt();



}
LATEST TUTORIALS
APPROVED BY CLIENTS