494 Answered Questions for the topic Java
04/05/20
Find and correct the error(s) in each of the following code fragments :
1. The following code should create an integer array and increment all the array elements by 1:int[] a = new int[5]; for( int i=0; i <= a.length; i++ ) ++a;2. The following code should compare...
more
Java
03/12/20
Cannot figure how to output numbers horizontally in Java
This is my code, it is suppose to output 10 numbers per line but it only works with the #7. I am ask to make the code user input-able, which that part is done.
import java.util.Scanner;
public...
more
02/15/20
Help is needed writing a simple JAVA class to check to see if a year is a leap year
A student wrote to me asking for help writing a JAVA program to calculate leap year. The assignment specified that the year must be evenly divisible by 4, but not 100. However, years divisible by...
more
Java
02/13/20
Why is my java (Tiny Encryption Algorithm) program not working?
package com.teaAlgo;class TEA { // Variables static int sum = 0x0; static int delta = 0x9e3779b9; static int lText = 0x12345678; static int rText = 0x9abcdef; static int key[] =...
more
02/12/20
Generate random numbers within a range with pre-defined sum
What if I want to generate random numbers within a range with a fixed sum?? For example: I want to generate 50 numbers between 50 - 100 but with a fixed sum of 4650 so that I would produce a mean...
more
02/12/20
How to generate random numbers with specific mean
Is there any formula that I can understand which will allow me to generate random numbers with a specific mean. I'm using java. Thanks
02/08/20
Java Programming Question: Intro to Computer Science
I'm working on a project for my computer science class in java and it is a travel agency. In one of the classes, Basket, I need to make an array of objects of type Reservation. But I also have to...
more
12/20/19
Which Skills do the IT companies Looking for?
What are thing we sholud keep in mind to prepare ourselfs for IT companies job.
12/18/19
Explicitly create Class for joining table or not for Java JPA many-to-many relationships
Hi,For those who have used Java JPA (Hibernate or EclipseLink) I wanted to ask your opinion on the best way to represent m2m relationships in the Entity classes. The choice as I see it is to...
more
11/10/19
Java String class
So we are given to write the exact output of the following code:class stri123{ public static void main(String[] args) { String name = "University Grants Commission"; boolean sword...
more
11/09/19
Java Program / methods
One sales shop offer following discount rates to customers based on their bill value.Bill value Range Discount ratebill value >= 10000 discount 20%bill value >= 5000 disocunt 10%bill value...
more
11/08/19
Java Number Patterns
How do we print,_ _ _ _1_ _ _2 1_ _3 2 1_ 4 3 2 1In Java?Please help, I don't know how to get started
Java
11/08/19
My Java program will not run in the browser, no sound either. Why?
import java.applet.*;import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.applet.AudioClip;@SuppressWarnings("deprecation")public class StopWatch...
more
Java
11/06/19
Java Programming applet
Hello, I have two assignments StopWatch.Java and Vote.Java. I'm supposed to use applet, but for some reason my programs don't run in the browser. Originally I was using Chrome and I found out that...
more
Java Computer Science
10/26/19
Java Time Calculator Program Help
Write a program using JAVA and FINAL variables that asks the user to enter a number of seconds.
There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or...
more
10/12/19
Java - arrays & loops
Question : Write a Java program to read integer data set(size of n<10) into an array and display its data graphically by plotting each numeric value as a bar of asterisks as shown in the...
more
10/03/19
Java Switch Case
How do we write the following code using switch statement ?if(option == 1) vehicle = "Motor Cycle" ;else if(option == 2) vehicle = "Car";else if(option == 3) || (option == 4)vehicle = "Heavy...
more
10/03/19
Java Programming
Hi, I'm new to Java. I've been working on this question, wrote the code and checked the results with some examples and it seems to be doing fine. I would be glad if any of the tutors can check the...
more
10/01/19
Java Switch Case
Why is the output of the code 14, not 8 : alpha=3+5=8?public class Application4{public static void main(String[] args) {int alpha=3;int beta=5;switch (beta){case 3:alpha=alpha+3;case...
more
Java
09/30/19
why displaying parent objects by child class object only giving default values !!?
class one{ int age; String name;}class two extends one{ void display() { System.out.println(age+name); }}class extenddoubt{ public static void main(String args[]) { one o=new...
more
Java
09/27/19
Question on binary number. The input is n binary number in n different rows, find the unrepeated binary row.
Question on binary number. The input is n binary number in n different rows, find the unrepeated binary row.write java programe
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.