32,204 Topics
| |
I'm trying to read one line at a time from a .txt using FileInputStream. [code=Java] FileInputStream in = null; // Open an input stream in = new FileInputStream("out.txt"); int c; while ( (c = in.read() )!= -1 ) textArea2.append(new DataInputStream(in).readLine() ); in.close(); [/code] For this out.txt: [code=java] abc abc lalala … | |
I am having trouble coming up with formula to print a triangle of numbers in a panel. I can print them to a specified number, of my choosing, but I can't seem to come up with a formula to print them out according to the size of the frame and … | |
Are there any Java documentation similar to the one at [url]http://www.cplusplus.com/?[/url] I have checked the official Java documentation at the Sun website, but it does not show as much information as the one that I use for C++. For one thing, there are no example codes =( | |
So the prompt is here: Assignment #2 will be the construction of a program that reads in an unspecified number of integers from standard input, performs some calculations on the inputted numbers, and outputs the results of those calculations to standard output. The numbers could be delimited by any kind … | |
I've create a program for the array of objects, here is the code..! [CODE]import java.io.*; class Student{ int rollno; String name; public void setValues (int rollno, String name){ this.rollno = rollno; this.name = name; } public Student getValues(){ Student s = new Student(); s.rollno=this.rollno; s.name=this.name; return s; } } class … | |
Hello to everyone, I'm trying to setup a Spring MVC project. I posted my configuration files below. I'll be really glad if someone helps me. Thanks in advance, With regards, Talha. [B]web.xml[/B] [CODE]<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>local</display-name> <context-param> <param-name>webAppRootKey</param-name> <param-value>webapp.root</param-value> </context-param> <context-param> <param-name>log4jConfigLocation</param-name> … | |
when we call servlet from a JSP page .. explorer/program moves to servlet page .... Such in my scenareo i have JSP form that on submiting call servlet to retrieve data from XML .. But problem is that . i like that on submitin form servlet runs in background without … | |
Hi, I am trying to develop a chess game using textual interface. I am using console read to capture moves and update the board accordingly. I am unable to remove Jlabel from the JPanel, i have called sthng lyk panel.remoove(label).......Can any one help me to sort it out plz or … | |
Hello, I have a jTextArea I want to use as an accounts panel by an administrator. The admin can append user + " " + password + " \n" to the jTextArea (one line per user + password). When someone tries to log in, the idea is to iterate through … | |
I downloaded data from google.com/favicon.ico and saved it in a file "icon.png" using the following: [CODE]URL url=new URL("http://www.google.com/favicon.ico"); InputStream ss=url.openStream(); byte bytes[]=new byte[100000]; int offset = 0; int numRead = 0; while (offset < bytes.length && (numRead=ss.read(bytes, offset, bytes.length-offset)) >= 0) { offset += numRead; } FileOutputStream out=new FileOutputStream("icon.png"); out.write(bytes);[/CODE] … | |
Create a program that will accept 20 numbers and arrange them in ascending order. The program should determine the distinct numbers and the number of occurrences for each number (or the frequency). Display the supplied values, the distinct numbers and the frequency of each distinct numbers. Your program should use … | |
Hey folks, plugging away at a new program for class and I have run into a little snag, or rather a fairly major one for my pea sized brain. We are working on constructing a sorted linked listed that will store author names as well as a sorted book list … | |
[code]import java.util.*; public class Account { int choice,initbal,amt,total,withdraw; int ch; void Initbal() { Scanner sc=new Scanner(System.in); System.out.println("Enter Initial Balance (>200) : "); initbal=Integer.parseInt(sc.nextLine()); while(initbal<200) { System.out.println("LOW BALANCE!!!Balance should be greater than Rs.200"); System.out.println("Enter again : "); initbal=Integer.parseInt(sc.nextLine()); } } void Detail() { Scanner sc=new Scanner(System.in); System.out.println("***************MENU***************"); System.out.println("1. Deposit"); System.out.println("2. Withdrawl"); … | |
i want to retrieve images from access database and display in grid layout. i have displayed 1 image successfully but how can i do this for all images together.i have stored images as BLOB | |
This code generates all permutations of the numbers 0, 1, 2,...., n-1. I am trying to get it to use recursion to do this. I am not compiling. I do not show errors, but I am not getting it to work. Can anyone see where I am going wrong? [CODE]import … | |
I am writing a toString method for my Nursery class but am having trouble getting everything working properly. I have to go through the ArrayList and call the toString method for each individual tree and then the sum for all of the trees prices. Here is what I got so … | |
Hey Guys I don't get what I need to add Im fairly new in Java. this is my code but it gives me these below the line errors below [code]import javax.swing.*; public class Movies { private String name; private double price; private int year; public Movies { name=""; price=0.0; year=0; … | |
Hi guys, I'm kind of stuck on a problem I was assigned. Pretty much we're trying to reverse words in a sentence. As in, input = Hi I am new to Java to: Java to new am I Hi I've tried this [CODE]String[]Tyler = new String[Sentence.length()]; Tyler[0] = Sentence; for(int … | |
In my Project SchoolManagementSystem there i've tuition fee record in database. So what i'm trying to do is increase the student due balance automatically after 1 month time. How can i do this? Eg: For now the due balance is 1000 and the monthly cost is 800 so after 1 … | |
I have two constructors that are pretty much exactly the same except that one also takes in a boolean value. I want the constructor with four parameters to the call the other one in order to get the the first three. Here is what I have so far. [CODE] public … | |
I figure my formulas are wrong and need tweaking. Can someone help[CODE]package mortgage_calculator; /* Write the program in Java (without a graphical user interface) using a loan amount of $200,000 with an interest rate of 5.75% and a 30 year term. Display the mortgage payment amount and then list the … | |
I have a java app that used to use a property and I am not sure with the changes I've made to the class path how to find the driver. I thought I was using the exact same installation but I can't find the driver. Can someone please tell my … | |
[CODE]import java.io.*; public class EnumEx3 { /** * @param args */ public static void main(String[] args) { Fishs fishs=Fishs.AMNON; System.out.println(fishs.getX()); } } enum Fishs { BURI(20), AMNON(50); private int x; private Fishs(int x) { this.x=x; } public int getX() { return x; } } [/CODE] i have that code and … | |
how do i use the same frame object for multiple classes...without overwriting the data..like..i am using a frame and i am using the same object on which i can draw a cirle..and then when i call another class to draw a rectangle..both circle and rectangle r being drawn...this is becuz … | |
I need to create a Car class that has the following fields: brand, model, and speed. Each of the fields should have accessor and a mutator methods. In addition the class should have methods that allows the user of the Car class to accelerate and to brake. Accelerating or braking … | |
For my final year project, I plan to write a cloud server using Python. The client will be written by the other team member in Java. The first and foremost problem I have is make the necessary communication between the server and clients. For server to client talk, I thought … | |
please guide me to connect java project to sql.Code snippets are welcome. | |
Why am i getting this error? Can someone help me? You can compile it. I'll post all the necessary codes. Because i dont have enough time. Please this is really urgent. *argg my head hurts*** I put in an archive. [CODE]http://h1.ripway.com/Caterwauler/findTheCheese.rar[/CODE] | |
We are writing a program in JAVA that thru a series of questions helps the user build a computer. This is being done with Radio buttons. We are wanting to know if it is possible to store the selections as objects in the database. So that is the user wants … |
The End.