32,199 Topics

Member Avatar for
Member Avatar for aabbccbryanmark

import java.util.*; public class LinkedListDemo { public static void main(String[] args) { LinkedList link=new LinkedList(); link.add("a"); link.add("b"); link.add(new Integer(10)); System.out.println("The contents of array is" + link); System.out.println("The size of an linkedlist is" + link.size()); link.addFirst(new Integer(20)); System.out.println("The contents of array is" + link); System.out.println("The size of an linkedlist is" + …

Member Avatar for stultuske
0
251
Member Avatar for hwoarang69

i am create animation in japplet and i want to know if iam using paint method and draphics2d the right way. public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; g2d.fillRect(x, y, width, height); //player }/** end of paint method ***/ another question i had was in run …

Member Avatar for JamesCherrill
0
254
Member Avatar for Atlanta15Braves

I am trying to sort a certain amount of integers. I have an error in my code. The code is below as well as my error message. Any suggestions of how to fix this? I believe it has to do with it being primitive data rather than an object? `public …

Member Avatar for subramanya.vl
0
371
Member Avatar for Kunai9292

A so-called “star number”, s, is a number defined by the formula: s = 6n(n-1) + 1 where n is the index of the star number. Thus the first six (i.e. for n = 1, 2, 3, 4, 5 and 6) star numbers are: 1, 13, 37, 73, 121, 181 …

Member Avatar for subramanya.vl
0
267
Member Avatar for joe.crook.9

In the last line of this method I am getting a missing return statement error, and I cannot figure out why. Any ideas? public static int parameter(int g){ Scanner console=new Scanner(System.in); String hint=console.next(); if(hint.equals("low")){ g=(g/2)+g; return g; }else if(hint.equals("high")){ g=(g/2); return g; }else if(hint.equals("correct")){ g=g; return g; } }

Member Avatar for stultuske
0
170
Member Avatar for devindra.storm

I'm having a weird problem where programs I write in Netbeans compile and run fine in the IDE, but when I try to run it from the command line, it finds errors and won't compile. A class file in the same directory that my main class needs to instantuate and …

Member Avatar for devindra.storm
0
162
Member Avatar for kanbear11

I have a person class public class Person implements Comparable<Person> { //Instance Variables private String firstName; private String lastName; private int age; private char gender; private String ssn; // This is the constructor of the class Person public Person(String firstName, String lastName, int age, char gender, String ssn) { this.firstName …

Member Avatar for kanbear11
0
1K
Member Avatar for francoiscx

Good day. I am trying to construct a mailto: url that will include the specific domain name or if possible the previous url from which a mail is sent from. I want to use this as an error report so that when an error is encountered by a person browsing …

Member Avatar for JamesCherrill
0
77
Member Avatar for thanatos1

Hello guys, I've been working on a game in Java, it doesn't use any third party libraries so everything was made from scratch, I was wondering if anyone was interested in helping me bring it to the next level. The game is going to be essentially a mix of Castlevania/Dark …

Member Avatar for lauried.shepherd
0
162
Member Avatar for WaltonPan

import java.util.Scanner; public class array_Project { int index; Scanner scan=new Scanner(System.in); System.out.println("Enter index number"); int[]Project={10,15,20,25,30,35,40,45,50,55}; } public class array2 { switch (int index) { case 1: if(index=0) { System.out.print(Project[0]); } break; case 2: if(index=1) { System.out.print(Project[1]); } break; case 3: if(index=2) { System.out.print(Project[2]); } break; case 4: if(index=3) { System.out.print(Project[3]); …

Member Avatar for aravind326
0
243
Member Avatar for Maritha33

Guys, I really need your help. I have a Project about any systems activities related to java Program and I choose Mini Search Engine. Can you please Help me of how to use Class and Objects cause I'm about to use them in my source code. thanks.

Member Avatar for JamesCherrill
0
326
Member Avatar for kbondarchuk

public static int f (int []a, int []b,int []c) { final int N=a.length; int j, k=0, g=0, t=0 ; for(int i=0;i<N;i++) { for (j=0;j<N;j++) if (b[j]==a[i]) break; if (j==N) { c[t]=a[i]; if (g==0 || c[t]>k) { k=c[t]; g=1; } t++; } } return k;

Member Avatar for JamesCherrill
0
211
Member Avatar for adishardis

Hi, I have a json_encoded array that comes out like this `{"y":33,"customTooltip":"BOK"},{"y":61,"customTooltip":"DRFlytt"},`... I need it to come out without the quotes surrounding the y and the customTooltip and singlequotes around the last value like this `{y:33,customTooltip:'BOK'},{y:61,customTooltip:'DR'},` Is this possible or should I find another approach? I derive the array like …

Member Avatar for adishardis
0
134
Member Avatar for nazmule27

What is NULL? Please answer if know it exactly in java Perspective.

Member Avatar for JamesCherrill
0
131
Member Avatar for jlemieux

I have an assignment to create 2 arrays. One holding Student names, one holding their grades. They then have to be sorted using BubbleSort, so that their grades are in descending order. I have created the first part of it, that allows me to put in their grades, and I …

Member Avatar for jalpesh_007
0
270
Member Avatar for johndy.maghanoy

how can i deleting an element in an array, then replace it with to 0 the move 0 to the last element???

Member Avatar for jalpesh_007
0
95
Member Avatar for almondjoy

hey guys, can you suggest a good java compiler for me? i had eclipse, but it literally FELL APART. thanks, almond joy

Member Avatar for jalpesh_007
0
103
Member Avatar for System Networks

'm new to Java and please try to explain to me. I am developing a game using slick2d and I'm making so called a shop.class and a player.class The shop class should add medkits to the player class. I have been making so many test on it even testing if …

Member Avatar for jalpesh_007
0
276
Member Avatar for crownedzero

I'm just curious about the use of frames/panels etc. What's are your general practices and why? Single main JFrame with multiple internal then toggling visibility of panels within? Just starting with swing and rather curious how other people implement them.

Member Avatar for jalpesh_007
0
135
Member Avatar for davkam

tickets consist of four colours: green, blue , red, and white. each ticket has an associated price: green cost €5, blue cost€10, red cost€20, white cost€30. write an enumerated class Ticket that has a toString method that pretty prints it and a getCost method that returns its cost.

Member Avatar for jalpesh_007
-1
208
Member Avatar for jalpesh_007

Dear all, I have following code and i want to write elements of array in single string(merge with ,) , in between all the values. like a[0] = "hi" a[1] = "hello" a[2] = 1 a[0] = "get" a[1] = "post" a[2] = 2 a[3] = 45 then i want …

Member Avatar for jalpesh_007
0
300
Member Avatar for hwoarang69

i know java c and c++ but i like java just because it was the first language i learned. i ask alot of people and they all seem to say "make game in c++" or "not a good idea to make games in java". what you guys think? should i …

0
95
Member Avatar for howardcartter

import javax.vecmath.*; import com.sun.j3d.utils.universe.*; import javax.media.j3d.*; import com.sun.j3d.utils.behaviors.vp.*; import javax.swing.JFrame; import com.sun.j3d.loaders.*; import com.sun.j3d.loaders.objectfile.*; /** * An example for constructing an object (tetrahedron) with triangles * where normal vectors are interpolated. * * @author Frank Klawonn * Last change 05.07.2005 * @see GeomArrayExample */ public class Isocahedran extends JFrame { …

0
97
Member Avatar for ashsha

I have created a polygon (6 points). Lets call this one, outside polygon. inside the outside polygon I created smaller polygons. I want to flip all of it vertically. I know the points of the outside polygon and I have an ArrayList for the inner polygons. I was able to …

Member Avatar for Taywin
0
386
Member Avatar for dlgmu537

I have written a code in java for the following scenario. There is a class called Student and it has registration number and name as instance variables and student count as a class variable. Student class has two methods called display which is supposed to display the details of a …

Member Avatar for dlgmu537
0
194
Member Avatar for marek2121

I have a problem with serializing an Arraylist. This is my method to serialize Arraylist: public void serializeObj(){ ArrayList<Actor> novylist = new ArrayList<Actor>(); novylist.addAll(components); try { FileOutputStream fileOut = new FileOutputStream("zeditoru.ser"); ObjectOutputStream out = new ObjectOutputStream(fileOut); out.writeObject(novylist); out.close(); fileOut.close(); }catch(IOException i) { i.printStackTrace(); } } components is Arraylist with theese …

Member Avatar for subramanya.vl
0
762
Member Avatar for abevenkat

how can i make a servlet to validate a form with two file upload one image and other a pdf file. along with the other string parameters like name age gender etc., i need to validate the pdf and image files in servlet and save it in folder of my …

Member Avatar for subramanya.vl
0
213
Member Avatar for Priyanka786
Member Avatar for Cudmore

Often we're faced with the need to represent primitive data types as readable/writable bytes that can be sent through a data stream. In Java, there are classes such as DataOutputStream/DataInputStream that can do the work for us, but often a programmer wants to manage the conversions himself (or herself, to …

Member Avatar for subramanya.vl
1
5K
Member Avatar for UNDER-18 FG

Here's my assignment question: > **Develop a Payroll class that consists of two user-defined methods, namely calculateNetPay() and printOutput() methods. The calculateNetPay() method is used to calculate the employee's net pay, as the formula follows: > > Net pay = gross pay - state tax and federal tax > > …

Member Avatar for subramanya.vl
0
676

The End.