170 Answered Questions for the topic Java

09/12/19

How to convert?

Write a program which asks the user to enter a number of meters and convert that value to miles, yards, feet, and inches. The conversion factor is 1 inch = 2.54 centimeters. Display your results to... more

07/29/19

Programming style in Perl?

I work in Java so basically I use OOP paradigm during coding.I am about to start working in Perl and I was wondering what is the paradigm that Perl developers follow.In wiki it mentions that it... more

06/19/19

Display 1,2,3,4,5,6,8,10,11 as 1-6,8,10-11?

> I have this sequence **1,2,3,4,5,6,8,10,11** > > Expected output is **1-6,8,10-11** This problem is about formatting the sequence in easy readable form I tried with c# and used many... more

06/19/19

How can I simplify this set of if statements? (Or, what's making it feel so awkward?)?

My colleague showed me this piece of code, and we both wondered why we couldn't seem to remove duplicated code. private List<Foo> parseResponse(Response<ByteString> response) { if... more

06/19/19

Fastest way to get sign in Java?

I'd like to get the sign of a `float` value as an `int` value of -1 or 1. Avoiding conditionals is always a good idea in reducing computational cost. For instance, one way I can think of would be... more

06/19/19

A java practice problem?

I came across this problem in javabat(http://www.javabat.com/prob/p183562): > We want to make a row of bricks that > is goal inches long. We have a number > of small bricks (1 inch each)... more

06/19/19

A java practice problem?

I came across this problem in javabat(http://www.javabat.com/prob/p183562): > We want to make a row of bricks that > is goal inches long. We have a number > of small bricks (1 inch each)... more

06/19/19

Fastest way of finding the middle value of a triple?

Given is an array of three numeric values and I'd like to know the middle value of the three. The question is, what is the <i>fastest</i> way of finding the middle of the three? My... more

06/19/19

Parsing Java Source Code?

I am asked to develop a software which should be able to create Flow chart/ Control Flow of the input Java source code. So I started researching on it and arrived at following solutions: To create... more

06/19/19

Why does this if statement, with an assignment and equality check, evaluate to false?

How does a Java *if statement* work when it has an assignment and an equality check `OR`-d together?? public static void test() { boolean test1 = true; if (test1 = false || test1 == false) { ... more

06/19/19

All possible words?

I want to create all possible 5 letter words using a-z.Please suggest any good and fast algorithms. I have tried creating one and it looks something like this... byte[] allchar=new byte[]... more

06/17/19

How to stop jucheck from running? Java won't remember "Check for Updates Automatically" setting?

I've installed Java on Windows Vista, and every day I get a Vista security warning asking me if I want to run "jucheck". Apparently this is the Java automatic updater.Well, I don't want it to run... more

06/06/19

Is there a way to create a jenkins job for a muti module maven project

I am trying to create Jenkins jobs for maven projects, each project has its own pom.xml file and when I specify the location of the pom.xml file while configuring Jenkins jobs and run the build I... more

05/29/19

Is there a Java equivalent or methodology for the typedef keyword in C++?

Coming from a C and C++ background, I found judicious use of **`typedef`** to be incredibly helpful. Do you know of a way to achieve similar functionality in Java, whether that be a Java... more

05/29/19

Is D a credible alternative to Java and C++?

Is the [D language](http://www.digitalmars.com/d/) a credible alternative to Java and C++? What will it take to become a credible alternative? Should I bother learning it? Does it deserve... more

05/24/19

Comparing two Calendar objects?

I want to compare two Calendar objects to see if they both contain the same date. I don't care about any value below days.I've implemented this and I can't think about any case where it should... more

05/24/19

Error: Could not find or load main class?

I am having trouble compiling and running my Java code, intended to allow me to interface Java with a shared object for Vensim, a simulation modeling package. The following code compiles without... more

05/24/19

Calling base class overridden function from base class method?

public class A {  public void f1(String str) {   System.out.println("A.f1(String)");   this.f1(1, str);  }    public void f1(int i, String str) { ... more

05/24/19

How would you access Object properties from within an object method?

What is the "purist" or "correct" way to access an object's properties from within an object method that is not a getter/setter method?I know that from outside of the object you should use a... more

05/24/19

Efficiently finding the intersection of a variable number of sets of strings?

I have a variable number of ArrayList<String>'s that I need to find the intersection of. A realistic cap on the number of sets of strings is probably around 35 but could be more. I don't want... more

05/13/19

Looking for a solution to simulating a step-based feedback system?

I am looking to simulate an on-line trading algorithm. I am looking for something similar to Simulink, or maybe even Labview, in the sense that I can define "blackboxes" of algorithms, connect... more

05/13/19

Convert from Radians to Degrees in Java?

I'm trying to get the alpha angle in degrees from x,y when user creates an object. I wrote the following constructor: public class Point { private double _radius , _alpha; ... more

05/12/19

Double-entry accounting libraries for Java?

What double-entry accounting libraries are available for Java?

05/12/19

Implemetation of WebUI objcet of katalon in junit for java

Hi there,I am workin with katalon automation tool for testing UI. I have record the UI actions in katalon and i get katalon scripts which inlude WebUI objects. Those objects are used for making... 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.