170 Answered Questions for the topic Java


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


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


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


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


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


Which Skills do the IT companies Looking for?

What are thing we sholud keep in mind to prepare ourselfs for IT companies job.


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


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


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


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


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 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 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


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


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


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


I have a session scheduled what do I need to do before

What do I need to do


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


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


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


C++ programming.

Algorithms -devising an efficient algorithm Write a function that is given an array of names and that removes duplicate names and keeps the remaining names in the order in which they first... more


How to allow users to input their own data.

I was taught a way to allow users to put in their own input instead of giving them a set variable. So instead of giving a user the set name "Sam" they could put "Dan" or "Shrek" etc... However when... more
1 3 4 5 6 7

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.


Find an Online Tutor Now

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