32,204 Topics

Member Avatar for
Member Avatar for sonu611

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 …

Member Avatar for shahbaz07dbit
1
1K
Member Avatar for rahul.ch

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 …

Member Avatar for rahul.ch
0
225
Member Avatar for dantheman4

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 ?

Member Avatar for Nutster
0
145
Member Avatar for london-G

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

Member Avatar for london-G
0
212
Member Avatar for mikias.kidane.9

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 …

Member Avatar for NormR1
0
247
Member Avatar for Sana'a Ala'a

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?

Member Avatar for Sana'a Ala'a
0
78
Member Avatar for jemz

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

Member Avatar for jemz
0
99
Member Avatar for dantheman4

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 …

Member Avatar for Starstreak
0
360
Member Avatar for Phadefrequency

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 …

Member Avatar for JamesCherrill
0
5K
Member Avatar for dantheman4

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

Member Avatar for NormR1
0
226
Member Avatar for jalpesh_007

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 …

Member Avatar for NormR1
0
245
Member Avatar for yup790

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 …

Member Avatar for JamesCherrill
0
200
Member Avatar for dantheman4

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

Member Avatar for JamesCherrill
0
108
Member Avatar for amir734jj

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

Member Avatar for zw_jvdijk83
0
91
Member Avatar for Hharla

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 …

Member Avatar for Hharla
0
194
Member Avatar for btbessaay

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 …

Member Avatar for VernonDozier
0
260
Member Avatar for FUTURECompEng

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 …

Member Avatar for FUTURECompEng
0
171
Member Avatar for spring2014

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 …

Member Avatar for NormR1
0
603
Member Avatar for minimee120

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 …

Member Avatar for NormR1
0
218
Member Avatar for Hemanth.Satkuri

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 …

Member Avatar for NormR1
0
140
Member Avatar for sidhartha93

after writing the codes and saving it..while i compile it in comand prompt it shows an error as 'javac file not found '

Member Avatar for NormR1
0
47
Member Avatar for aabbccbryanmark

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 …

Member Avatar for aabbccbryanmark
0
202
Member Avatar for gelmi

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

Member Avatar for Nutster
0
423
Member Avatar for green_ning

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

Member Avatar for green_ning
0
266
Member Avatar for aabbccbryanmark

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

Member Avatar for JamesCherrill
0
109
Member Avatar for rvijaya

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

Member Avatar for rvijaya
0
152
Member Avatar for tformed

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 …

Member Avatar for jalpesh_007
1
328
Member Avatar for javaprog200

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!

Member Avatar for rotten69
0
173
Member Avatar for forjustincase

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 …

Member Avatar for DJSAN10
0
128
Member Avatar for Raghu88

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

Member Avatar for Raghu88
0
266

The End.