398 Posted Topics
Re: [QUOTE=riahc3;1736562]Hey Lets see if I can explain myself correctly...... I have 2 projects, one a program and another a library. First project is basically this, more or less (obviously it is more complicated) [code] //This is the main project //Inside com.stuct: //Global.java package com.stuct; public class Global { public static … | |
Re: I agree with stultuske, is this your entire code? please post it, because if the array is declared correctly(although 2d not needed-if thats your full code and array), your first line should print regardless of println() or print() the difference would be your 'Heat 2:' would be on the same … | |
Re: [QUOTE=jt_4285;1733340]thank you very much for the reply. Stultsuke .i have done whatever u have suggested .but the same error is coming. is there problem with my netbeans? its 7.0.1 whenever i m writing any program on it ,it is showing the same error ,"Could not find or load main class" … | |
Re: [QUOTE=applejax77;1736924]Updated code below. Took out some unneeded code and still having problem with program to NOT recognize lower or upper case when use imputs letter from the userChar code. How do I get java to recognize or should say not recognize small or upper case and still execute the program … | |
Re: [QUOTE=amture101;1736947]well I'm trying [CODE] String filename = "table.file"; JTable table = new JTable(elements, header); TableModel tm = table.getModel(); try { FileOutputStream fos = new FileOutputStream(filename); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(tm); oos.flush(); oos.close(); } catch (IOException e) { e.printStackTrace(); return; }[/CODE] but it only delete the old entry and write … | |
Re: well you dont need the do while statement, the while statement will do the job correctly-verifying the variable before executing, where as the do while verfiys the value at the end of each execution. also incorporate the 'number = console.nextInt()' into your while statement that should fix it :) | |
Re: [QUOTE=Ms New to Java;1736121]but sir, do u think that my codes have the chance of showing the right output that i want with few revisions? because im losing hope little by little haha![/QUOTE] Reading through this thread, and having seen your past threads, you learnt a lot while writing this … | |
Re: In Java, 2D arrays are really arrays of arrays with possibly different lengths (there are no guarantees that in 2D arrays that the 2nd dimension arrays all be the same length) You can get the length of any 2nd dimension array as z[n].length where 0 <= n < z.length. If … | |
Re: [QUOTE=behemothdave;1735801]My assignment is as follows: Create aJApplet that contains twoJTextFields, aJButton, and threeJLabels. When the user types an employee’ s first and last names (separated by a space) in a JTextField, the employee ’ s job title is displayed in a secondJTextField. Include two JLabels to describe theJTextFields used for … | |
Re: As NormR1 said, as far as i can see the first code you posted to start the thread was just fine? and the reason is look at what the shuffle methods definition is:"Randomly permutes the specified list using a default source of randomness. All permutations occur with approximately equal likelihood. … | |
Re: [QUOTE=OVOXO;1735161]So I'm looking for a way to assign a set of numbers in a random way in a 2d array. The array is {1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10} How would I assign these values randomly in a 5 row and 4 column array? Or is there a way to generate a random number for … | |
Re: [QUOTE=sirlink99;1733927]The code I am using currently is [CODE] int rand = new Random ().nextInt(length - 1); [/CODE] and when I generate many results it isn't even close to uniform distribution a number from 0 and 999 generated 600000 times and graphed[/QUOTE] whats the value of your length? and as JamesCherrill … | |
Re: as Ezzaral said: '=' is for assignment '==' is for equality | |
Re: also it might be of use to put a try catch statement surrounding the 'repeat()' method. | |
Re: [QUOTE=vinay.tmr;1734944]i want to Read DATA From A text file and save it in database and print the logs by using JAVA.? PLSSSSS HELP....[/QUOTE] well i guess first you need to read in the text from the text file. Have a google on 'Read Text file in java' and there is … | |
Re: [QUOTE=riahc3;1734976]Hey I want to create a JAR library but not sure how to in MyEclipse. Im currently doing it manually using jar command but I cant seem to get it correctly The library code is: [code] public class LibAdd { public static int addtwonumbers (int a,int b) { return a+b; … | |
Re: [QUOTE=Ms New to Java;1734988][CODE]class DoWhileDemo { public static void main(String[] args){ int count = 1; do { System.out.println("Count is: " + count); count++; } while (count <= 11); } }[/CODE] can someone please rxplain to me how does Do while statements work? and how can i use it in my … | |
Re: [QUOTE=Ms New to Java;1734965]how about do while sir??? how do i use it? whats the difference between while only, from do while?[/QUOTE] I would suggest making a new thread, as you already marked this as solved, so people may not know that there are still posts happening here? Just a … | |
Re: [QUOTE=adarshcu;1733465]Hi, I'm not quite sure if there is a thread for Eclipse related query separately. But since this is a java related one. I'm posting it here. Is it possible that i can have PMD check run on a project by default ? Instead of clicking on my source file … | |
Re: [QUOTE=Empireryan;1734487]I see what I did. I wrote this:[CODE] int [] numbers = { 2, 3, 4, 5}; int [] numbersCopy = numbers;[/CODE] when I should have done this:[CODE] int [] numbers = { 2, 3, 4, 5}; int [] numbersClone = (int[])numbers.clone(); [/CODE] No way for sort methods to leave … | |
Re: you could also use a siple count, that will start off at zero and when the event if fired it will add one to the counter, the next time the event is fired it will check the counter and act appropriately i.e(psuedo): [code] eventfired(Event e) { if (counter==1) { System.out.println(e);//would … | |
Re: i'd suggest making the method getMonth() static... also why are you calling getMonth() using the class name if its in the same class? [code] int month = scan.nextInt(); System.out.println(getMonth(month)); [/code] the above code will be just fine if the getMonth() method is static. however if you do not want to … | |
Re: take a look here: <URL SNIPPED>. this shows you how to convert a int to a string maybe if you want a really unique assignment look at it and edit it to accomodate 10001 :) | |
Re: The best i can suggest is using a shared variable, thats either true if the thread must continue its work or false if not? and then let your thread continuelly check that value and when it changes then it must quit i.e [code]while(runthread) { //do work //more work //done work … | |
Re: Please also note, that there should be either 1 0r two blank lines after the main class. i always use 2 just in case | |
Re: why are you using this [code]if (counter % 3 = 2){ }[/code] i dont get the '% 3' and to be honest this must be the first time ive seen such an if statement | |
Re: [QUOTE=boris90;1733756]Hi, this is my first post here, and I really need some help with my homework. I'm a newbie to Java programming, and I have this assignment: [I]Write an application which reads data from a file about certain items (one row - one item, stored are the integer valued code, … | |
Re: [QUOTE=eng_mary;1733576]Hi everybody I'm trying to write such a code: [CODE] import pps.PPSFrame; public class X extends PPSFrame{ ..... } [/CODE] Of course there's no such pps package in java. Where can i find it ? or at least PPSFrame.class ? Regards,[/QUOTE] I do see there is a class or package … | |
Re: Hmm a little of topic but maybe before continueing with your current server client have a look at the java RMI? a brief definition of it on oracle is: The Java Remote Method Invocation (RMI) system allows an object running in one Java virtual machine to invoke methods on an … | |
Re: well for starters you don need this: [code] String a =(String)(JOptionPane.showInputDialog(null, "Automatic Teller Machine\n [B] Balance Inquiry\n [D]Deposit\n [W] Withdrawal\n [Q] Quit\n Select you Options: ","Automatic Teller Machine",JOptionPane.PLAIN_MESSAGE));[/code] it can just be: [code]String a =JOptionPane.showInputDialog(null, "Automatic Teller Machine\n [B] Balance Inquiry\n [D]Deposit\n [W] Withdrawal\n [Q] Quit\n Select you Options: ","Automatic … | |
Re: adding to what you need to fix would also be: [code=java]System.out.prntln[/code] to [code=java]System.out.println[/code] which you had correct at the bottom of your code but not the top also i see your if else statements look like this: [code]if (VariableOne > VariableTwo && VariableOne > VariableThree){ int Biggest = VariableOne; else … | |
hi all, I am creating a basic threaded server and chat client... so far everything is going to plan however i am confused as to how i will make two clients(which ever they maybe) connect and send their data to each other. My idea is in the server app i … | |
Re: [QUOTE=sha11e;1731706]I have another question, though. How would I go about making it like chat?[/QUOTE] Definitely multithreaded | |
Re: [QUOTE=DSLKeper;1730393]If I understand your package question correctly it stared out as a phpFox site 4 years ago but quickly changed to a custom site with many modifications and custom additions. I first noticed that the site was blank yesterday. I spoke to the current webmaster. He is at a loss … | |
Re: Hmm, might sound stupid but the JavaMail API is optional and might not have come included with your netbeans 7.0 and java 7? see this: [url]http://www.oracle.com/technetwork/java/javamail/index.html[/url]. if you have already downloaded it then as stultuske said try his advice. | |
Re: [QUOTE=JerryRong;1715235]i created a loop and it doesn't run: [CODE] for ( int i = 0; i < 100; i++) { for( int j = 0; j < 100; j++); { int total = i + j; } System.out.println( total ); }[/CODE][/QUOTE] hey there Jerry: The problem is that you are … | |
Re: how about you take this vb script which will create a shortcut on your desktop edit it as needed : [code]Set objShell = CreateObject("WScript.Shell") strPath = Shell.SpecialFolders("Desktop") Set objLink = objShell.CreateShortcut(strPath & "\test.lnk") objLink.Arguments = """1 2 3""" objLink.Description = "This Launches Notepad" objLink.HotKey = "CTRL+ALT+SHIFT+X" objLink.IconLocation = "Notepad.exe,0" objLink.TargetPath … | |
Re: hmmm what line is line 14 in your original code because thats the line thats throwing the exception.... | |
Re: hmm as far as i know the host would be your email holders pop3 or smtp server address. ie googles SMTP address for gmail is smtp.gmail.com or pop.gmail.com yahoo is: smtp.yahoo.com or pop.yahoo.com etc just google it, however you then need password authentication try using the JavaMAil API-if you arent … | |
For now the code isn't to complex. Built in Netbeans 7 java 6.... just the basis for now but its very safe connection so thought i'd post it for anyone who needs it. A quit command may be sent to any client by specifying its ID and then press enter … | |
Re: [code=java] try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String url = "jdbc:odbc:Driver={Microsoft Access Driver "//makes it use access driver + "(*.mdb, *.accdb)};DBQ= c:\\StudentDatabase.accdb";//gets database at its path con = DriverManager.getConnection(url);//creates connection Statement st= con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); String SQL = "Select empid,ename from emp"; ResultSet rs= st.executeQuery(SQL); while(rs.next()){ System.out.print(rs.getString()); System.out.println(rs.getString()); } } catch (SQLException e) { … | |
Re: could you please post your source here to elaborate as how can two courses have the same id? also the source of your database will help | |
Re: Recompile with -Xlint:deprecation for details. all this means is that the code you compiled has an API which might change or be removed from the java sdk. for example type 'hide();' and if you are using netbeans a line will be shown through name of the API, and your compiler … | |
Re: use rs.getString() and then convert to a char maybe [code=java] /* String ss="h"; char cd=ss.charAt(0);//0 because a char is only a single character so get first and only letter of the string */ char c=rs.getString().charAt(0);[/code] | |
hi everyone, I am writing a small client and server application in java which uses SSL sockets and AES, i got this from the net and edited it a bit is this correct and secure? client: [code=java]/* * To change this template, choose Tools | Templates * and open the … | |
Why is there so many questions in this forum on really simple gui problems that can easly be solved by using an IDE such as netbeans and creating the gui from there .... I mean thats what is there for why still use the old way? beacuse you like to … | |
Re: n the first parameter for setDefaultRenderer, put the class literal for the Class that you want to override rendering. I.e., if your data consist all of strings, you can put [code=java]myTable.setDefaultRenderer(String.class, new CustomRenderer());[/code] If your data also consists of values with BigDecimal or Integer as classes, you have to invoke … |
The End.