32,204 Topics
| |
Hi all, I was looking for a way to execute windows batch file from java code, and I was able to do this with the following code. [CODE] Runtime rt = Runtime.getRuntime(); Process proc = rt.exec("cmd /C " + "path" +exec.bat"); [/CODE] The batch file refers to some other files … | |
import java.util.*; class SampleA { } class SampleB extends SampleA{ } class SampleC extends SampleA{ } class VectorDemo { public static void main(String r[]) { Vector<SampleA> v = new Vector<SampleA>(); v.add(new SampleB()); v.add(new SampleC()); SampleC rect = v.get(2); } } The output says "Incompatible types. Found SampleA, required SampleC. SampleC … | |
public static void total() { Scanner s = new Scanner("five six seven eight"); int num= 0; for(int i=0; i < s.length; i++) { if(s.charAt(i).equals("a") || s.charAt(i).equals("b") num++; } System.out.print(num); } public static void main(String[] args) { total(); } > What am I doing wrong ? | |
Hello, I have 3 combobox and I want to find them in my table "class" and retrieve the ID. I am currently having trouble with the following code: public void retrieveClass(String time,String stage, String teacher){ Connection con = null; ResultSet rs = null; java.sql.PreparedStatement st = null; Properties conProps = … | |
I am having a problem with arrays.... for this assignment i can not use Arraylist... I only be able to use array of string. here is my problem. I am asking the user to enter words with in 1 minute ... when the time is up ..i need to print … | |
Hi there i'm thinking of starting a database project but i want the DB to be located in a PC works as a server and distribute this DB over an internal network, so many users (clients) can access the DB from their own PC. Any good tutorial or example? | |
Hello, Is there a way to put some security in the jar files? the java codes are inside the jar file how do i prevent user to see my java codes... | |
import java.util.Scanner; public class LoopPatterns { /** * @param args */ public static void main(String[] args) { public static double Largest { Scanner s = new Scanner(System.in); int num, largest = 0; for ( int i = 1; i <= 10 ;i ++) { System.out.print("Enter a number : "); num … | |
define a class containing overloaded method which calculate are of square circle and rectangle depending on the type and numbers of arguments passed. If the number of argument passed to the are is one ,then the area of the cicle and suare should be displayed,however if it is 2 then … | |
import java.util.Scanner; public class LoopPatterns { /** * @param args */ public static double Largest (){ Scanner s = new Scanner(System.in); int num, largest = 0; for ( int i = 1; i <= 10 ;i ++) { System.out.print("Enter a number : "); num = s.nextInt(); if ( num > … | |
I have made one program that work on hash map. I want to do one thing. All the tuples(row) with defined quasi identifier location having value >=k will be moved from map m1 to asMap and it also removed from m1. So at last i am printinf the output of … | |
I am 2/3 thirds of sams teach yourself java in 21 days and I would like to know what to do to get proficient with programming. I heard I should look at source code, if so where can I find some. What kind of projects should I do. Should I … | |
> I am supposed to create a method called compareParity which compareParity that takes a Scanner containing words as its parameter. The method should return true if the Scanner contains more strings of even length than strings of odd length, and false otherwise. For example, compareParity(new Scanner("The quick brown fox … | |
String s1 = "+1-2+3-4+5+6-7"; String s2 = "1-2+3-4+5+6-7"; I want to find the value of sum of each of those string in integer ? there can be only addition or subtraction | |
Hi, I'm having problems with this assignment. First off a Markov matrix is simply a 3x3 matrix that when the rows are added always equal 1. I am suppose to write a program to prompt the user to enter a matrix and then it is determined wether or not that … | |
I made a battleship game and its gone well except for checking if the ship is sunk... Any help? Here's what I have so far, thanks in advance. public class BattleShip { private static final int dimensions = 10; private String[][] board = new String[dimensions][dimensions]; private String[][] piecesBoard = new … | |
I have the user input a sentence (example " Hello this is some jello "). I already have that complete by having a method to do this. What the method does is take a user input (.nextLine) then stores the words of the sentence into String[] words and I use … | |
The purpose of the program is to take 4 user inputed integers (days, hours, minutes, and seconds) and output them as a floating point doubles to show the maximum amount of time possible for each. For example I input 2 days, 10 hours, 45 minutes, 20 seconds and it outputs … | |
Hi, I'm completely new to Java and having some trouble basically understanding everything. I have some code and am wondering how to edit it in order to make some questions that I'm being asked to work. Here's the code: import java.util.*; // for class Scanner public class Copy { public … | |
Hi , I have a java string like: From: someuser.ha@domain.comDate: 8/7/2012 5:20:39 PMTo: abcd@domain.comCc: abcd.efg@domain.comSubject: This is the suject line Hi,I would like to recover all my money from the bank. Would you be able to send me them?Regards,Farooq. Actually above is the email content which is read as a … | |
after writing the codes and saving it..while i compile it in comand prompt it shows an error as 'javac file not found ' | |
import java.io.*; public class QuizBee { public static void main(String[] args)throws IOException { BufferedReader a = new BufferedReader(new InputStreamReader(System.in)); int cor=0; System.out.println("\t \t \t \t \t \t \tWelcome to 10th Annual Quiz Bee of the Year"); System.out.println(); System.out.println("General Direction: In this question you are obligue to answer them honestly."); System.out.println("\t … | |
**Enter row number: 4 Sum of numbers in row 5 is 31. Sum of all numbers above 4 is 15. this should be the output look like.. can someone help me? thanks. | |
Hello guys. I am a starter in Java Programming. And I wanted to understand and manipulate it effectively from now on. I also want to start developing applications in iPad or iPhone but I am a Windows user, and I guess I need a Mac in able to do that. … | |
System.out.println("\t \t \tYou got " + (cor/10*50+50) + "%"); help me with this code.. i didn't get what's supposed to be the percentage.. what's wrong with it?.. i got 3 for cor and i should have 65% but i just get 50%.. | |
Hi, so I have to write a program for my Java assignment and I am just starting out so I might be doing this wrong but I can't figure out why it won't invoke the method I have created. import java.util.Scanner; public class EvalMarks1 { public static void main(String[] args) … | |
Hi guys, I've got the program running, but not as how the instructor requested. The professor wants us to ask the user for a text file and classify the data accordingly. Example: E = Enter L = Leave So if I have a text file with the following info E … | |
Hello, Are any of the older exams for the Sun Certified Java Programmer certification available online? I was able to find mock exams and other test prep material. Just wondering if earlier exams are available. Thank you! | |
Can someone help me understand the code below? I'm trying to figure out how it's getting the text file to read from. public static void main(String[] args) throws Exception { if( args.length < 2 ) { throw new Exception( "Usage: inputFileName outputFileName"); } Box d = new Box(8); PrintWriter pw … | |
package com.zyom.struts.ats.action; import java.io.File; import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import jxl.Workbook; import jxl.write.Colour; import jxl.write.Label; import jxl.write.WritableCellFormat; import jxl.write.WritableFont; import jxl.write.WritableSheet; import jxl.write.WritableWorkbook; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import org.apache.struts.actions.DownloadAction; import org.apache.struts.actions.DownloadAction.ResourceStreamInfo; … |
The End.