493 Answered Questions for the topic Java

Java

03/14/19

How to set or change the default Java (JDK) version on OS X?

How can you change the default version of Java on a mac?
Java

03/14/19

Why are you not able to declare a class as static in Java?

Why are you not able to declare a class as static in Java?
Java

03/13/19

How do I programmatically determine operating system in Java?

I would like to determine the operating system of the host that my Java program is running programmatically (for example: I would like to be able to load different properties based on whether I am... more
Java

03/13/19

String.equals versus ==?

This code separates a string into tokens and stores them in an array of strings, and then compares a variable with the first home ... why isn't it working? public static void... more

Is PHP front end or back end?

Java

03/13/19

Java: convert List<String> to a String?

JavaScript has `Array.join()` js>["Bill","Bob","Steve"].join(" and ") Bill and Bob and Steve Does Java have anything like this?
Java

02/24/19

Drawing a half arrow (Java)

Is anyone able and willing to help me? Here is the task:This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by user... more

What does 'static' mean in Java?

Java

11/23/18

covert algorithm to code java

INPUT initial approximation p0; tolerance TOL; maximum number of iterations N0.OUTPUT approximate solution p or message of failure.Step 1 Set i = 1.Step 2 While i ≤ N0 do Steps 3–6.Step 3 Set p =... more
Java

11/22/18

Howto create a java program that uses both observer design pattern and strategy design pattern?

Use the Java Observable /Observer classes to create an Observable object that provides "real - time" election statistics. For the purposes of this assignment you can just report on any five states... more
Java

09/13/18

Every variable in java must be declared before it is used

Informatics, I'm trying to find true or false answers 
Java

04/23/18

stacks and heap?

<!DOCTYPE html><html><body>i don't know what is stack and heap memory i saw many <a href="tutorials for java.com">tutorials for java</a> to learn this but i'm unable... more

04/03/18

What is wrong in this program ?

import java.util.*;class Twin{ int n=0; int c=0; int Is_Prime(int a) { for(int i=1;i<=a;i++) { if(a%i==0) c=c+1; } if(c==2) return 1; else { return 2; } } } public class Twin_prime{ public... more

How many calls to mystery are made (including the first call) of mystery(0, 4, 5) when arr = {1, 2, 3, 5, 7}?

Give the following code:private int[] arr;public int mystery(int low, int high, int num) { int mid = (low+high) / 2; if (low > high) { return -1; } else if (arr[mid] < num) { return... more

08/08/17

Create a java program that will asks the user's height in centimeters and display the equivalent feet and inches.

Create a java program that will asks the user's height in centimeters and display the equivalent feet and inches. Possible output should be.   Please enter your height(cms):_________ Your... more
Java

07/20/17

Something is wrong with my program. It keeps saying that 4 lines of code are wrong.

Can anyone help me?     The 4 lines of code that are wrong: import java.awt.Dimension;import java.awt.Graphics;import java.awt.Color;import javax.swing.*;           The code: package... more
Java

07/19/17

Homework problem is in the description

Prepare a program that will perform the followings:1) It will prepare a drawing area of 600 pixels by 600 pixels.2) It will draw (not fill) a black rectangle with the following 4 corners: (100,... more
Java

07/18/17

Plz help me answer this

Prepare a program that will perform the followings:1) It will prepare a drawing area of 600pixels by 600 pixels.2) It will draw (not fill) a black rectangle with the following 4 corners: (200,... more

Need help writing a code in Java.

I am asked the following.   Write a program that determines change to be dispensed from a vending machine using the least number of coins. An item in the machine can cost between 25 cents to a... more

Trouble with a code segment in Java

  What's wrong with the following code segment?final double TAX_RATE = 0.08;TAX_RATE = 0.0875;   This question is confusing. When I copy this into my Java IDE, it can't compile and i'm left with... more

06/26/17

I don't understand this question. Anyone care to help?

I am asked   What are the difference among 1, 1.0, '1', and "1"?   And I don't understand the question at all. Can anyone explain to me or help me with this question? This question pertains to... more

Challenge exercise Java

I need help with problem 41. Exercise 3.40 Assume a class Tree has a field of type Triangle called leaves and a field of type Square called trunk. The constructor of Tree takes no parameters and... more

04/13/17

can someone please answer my question about java script pig layin loop ?

input: nouf chapter//startsystem.out.println("Enter a list of words ending in ' .':");String word=input.next()String... more

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.