|
Hello everyone.
My name is Willem. I am a teacher and decided to do the OCA exam. I teach computer literacy and hope to teach Information Technology to our high school students.
Is there a reputable site that offers free VCE exams that I can use to prepare for the exam. Please also recommend paid sites. I found a few, but paying around $50 for just one exam with roughly 70 questions seems a bit extreme.
I will appreciate any help.
|
|
|
|
|
Google is the place to search for such sites, especially as you may want them in your local language. As to whether they are reputable, you have to decide that for yourself.
|
|
|
|
|
Hello,
I have written the following code , here i am setting the priority of 3 threads ,As threads are executed according to highest priority But the output is not showing accordingly why is it??
package collection;
public class Pri extends Thread{
public void run()
{
System.out.println(Thread.currentThread().getName()+" "+Thread.currentThread().getPriority());
}
public static void main(String[] args) {
Pri p1=new Pri();
Pri p2=new Pri();
Pri p3=new Pri();
p1.setPriority(2);
p2.setPriority(4);
p3.setPriority(6);
p1.start();
p2.start();
p3.start();
}
}
Output is :
Thread-0 2
Thread-1 4
Thread-2 6
As output should be like
Thread-2 6 Thread-1 4 Thread-0 2
|
|
|
|
|
The output is exactly as you have coded it. Your problem is that you start the threads in order so by the time the p2 gets executed p1 has already done its work.
|
|
|
|
|
But highest priority thread is p3 here so why it is not showing the
Thread-2 6 first than
Thread-1 4
Thread-0 2
|
|
|
|
|
Because thread p3 is the last to be started. Your code is not a valid test of anything useful. Thread priority only works in a long running process when you have parallel threads contending for the CPU. All you have is three threads, which run sequentially one after the other, perform a single very simple task and terminate. So there is no point at which the system has to make any decision as to which one should be active.
|
|
|
|
|
|
Don't post this here - if you got the code from an article, then there is a "Add a Comment or Question" button at the bottom of that article, which causes an email to be sent to the author. They are then alerted that you wish to speak to them.
Posting this here relies on them "dropping by" and realising it is for them.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I was looking at the code for a tictactoe game the other day and saw something that confused me.
The X and O were called Pegs. They were not called X and O out right. They were just trying to put down code that simulated players taking turns placing a Peg. The game would switch between first player and second player turn:
private Peg currentPeg;
private Peg[][] cells = new Peg[SIZE][SIZE];
public Peg checkRowMatch() {
for (int i = 0; i < SIZE; i++) {
if(cells[i][0]== cells[i][1] && cells[i][1] == cells[i][2] && cells[i][0] != Peg.NONE){
return cells[i][0];
}
}
return Peg.NONE;
}
public Peg checkColumnMatch() {
for (int j = 0; j < SIZE; j++) {
if(cells[0][j]== cells[1][j] && cells[1][j] == cells[2][j] && cells[0][j] != Peg.NONE){
return cells[0][j];
}
}
return Peg.NONE;
}
public enum Peg {NONE, FIRST, SECOND};
As you can see, the variable Peg was used as a type declaring different things. It was used as an enum, an array, as methods. My question is how. There is no class Peg anywhere in the code so how is Peg being used as some king of data type?
|
|
|
|
|
Peg is an enum only, and can have one of the values NONE, FIRST, SECOND . The statement
private Peg[][] cells = new Peg[SIZE][SIZE]; declares the variable cells as an array of Peg s, it does not declare Peg as an array type. Similarly the two method definitions are not defining Peg as the method, but as the return type, from the methods with the names checkRowMatch and checkColumnMatch . As you can see in each case the method returns a Peg enumeration value.
|
|
|
|
|
I am a beginner and trying to write a small Java MDI Application. I wrote a ToolBar class to use a common tool bar to child forms.
import java.awt.BorderLayout;
import javax.swing.*;
public class ToolBar extends JFrame {
JToolBar tb;
JButton exit;
public ToolBar(){
setSize(400,400);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
tb = new JToolBar();
exit = new JButton("Exit");
tb.add(exit);
add(tb,BorderLayout.WEST);
}
I called the class in the child form like below
public FrmItemTypes() {
initComponents();
ToolBar t = new ToolBar();
t.setVisible(true);
}
and used the menu to open the child form.
FrmItemTypes ft = new FrmItemTypes();
this.desktopPane.add(ft);
ft.setVisible(true);
Before use the tool bar, it is loading well. But when I say
ToolBar t = new ToolBar();
t.setVisible(true);
the child form comes out from the main form and it shows like a normal form.(Not like a MDI child)
Please help...
|
|
|
|
|
|
Hi,
If DatePicker receives a value, then it will be stuck with that value, even if you remove the date text from it's TextField, or even if you write a text that isn't date format (random characters). Is there a way to tell it to change it's value to null, if the text from TextField is removed or if the text isn't date format (ex: "adasda" instead of "10.10.2010")?
modified 29-Sep-18 12:53pm.
|
|
|
|
|
After some testing on different machines, I found out that this problem occurs only with Java JRE 10.0.2. Using Java JRE 1.8.0, DatePicker runs without any problems and has all the features.
|
|
|
|
|
Hello! I am new to Java and am looking for a source code for automatic license plate recognition.
someone can help me?
thank you in advance.
|
|
|
|
|
Member 13918755 wrote: someone can help me? Yes, it is called using a search engine: www.google.com[^]
|
|
|
|
|
Automatic vehicle license plate recognition is an important component of modern intelligent transportation systems (ITS). Generally vehicle license plate recognition is divided into several steps including license plate extraction, image region which contains a license plate, character segmentation, and character recognition. Automatic license plate recognition system using Camera mounted over the exposure system image of the license plate is captured and the image is processed to extract the license number.
|
|
|
|
|
Hi,
On my workstation the program I made is running well, but here I have Java JDK installed.
When I was done and tried to run it on a different machine, the program starts, and for a split second the GUI shows then the whole program closes itself. After some testing, I found out that the problem somehow is Java JDK.
If I install Java JDK on the testing machine, the program runs fine, even if I uninstall Java JDK after that, the program still runs, which makes me think it might add additional jars in Java folder. If I uninstall Java, and reinstall only java, the program again won't work unless I install Java JDK too.
Did anyone encountered this problem too, or knows a fix for it? Am I right about JDK actually adding additional jars in Java folder, which remain there even after JDK is uninstalled?
Here is a list of libraries my program uses, I marked them at the end with [] because I'm using multiple classes from them and the list would have been way too long if I was to add all of them:
import com.sun.glass []
import java.awt []
import java.io []
import java.net []
import java.text []
import java.time []
import java.util []
import javafx []
Also, I'm using a DLL file, but from my testing that one isn't the problem, as I said, the JDK is somehow.
Hope I explained the problem well enough, if not, I'll happily answer any other questions.
OS: Windows 10 x64 Pro on both machines.
|
|
|
|
|
Any Java application should run on any system that has the correct JRE loaded. Are you sure that the version of the runtime on the test machine is the same as, or later than, the one on the development system?
|
|
|
|
|
Yes, I'm sure, I tried it on a VM and on my laptop, and on both I have to do what I said in the main post.
|
|
|
|
|
Well it is anyone's guess what your program is doing wrong. You will need to find a way to gather more information.
|
|
|
|
|
I did a little more testing, and it seems that I need the JDK installed in order for it to load the DLL. That DLL only adds the minimize function to an undecorated stage, when clicked on taskbar.
The GUI shows for a split second because the DLL is loaded just after stage.show().
I'm loading and using it with:
System.load(System.getProperty("user.dir") + "\\Data\\Minimize_x" + windowsVersion + ".dll");
addMinimize(Window.getWindows().get(0).getNativeWindow());
|
|
|
|
|
I do not have a system available that I can test that. However I have used a similar construct in the past and it worked fine without the JDK. If you are certain that is the problem, and can reproduce it with a small test sample, then you should report it to Oracle.
|
|
|
|
|
As I said, the DLL only adds that function, so I should be able to reproduce it with a simple blank stage.
Thanks.
|
|
|
|
|
I just reproduced of the problem, but this time I even tried JDK 10, rather then 8 which I used in the main app, and has the same problem.
I added this one on drive, with jar and sources in format that can be read online without download.
Link in case you want to see
|
|
|
|