Welcome to Java Class: Learn Java One Bit at a Time

Click For Summary

Discussion Overview

The discussion focuses on the basics of learning Java programming, including setting up the development environment, compiling Java code, and understanding key concepts such as source code, object code, and the runtime environment. It encompasses practical steps for installation and execution of Java programs, as well as clarifications on terminology used in programming.

Discussion Character

  • Technical explanation
  • Conceptual clarification
  • Homework-related

Main Points Raised

  • Warren describes the need for a compiler and a runtime environment to execute Java programs, explaining the roles of source code and object code.
  • Warren outlines the directory structure of the Java SDK and identifies key executable programs, java.exe and javac.exe, necessary for running and compiling Java programs.
  • Warren provides a step-by-step guide for compiling a simple Java program using the command line, including creating a convenience batch file for compilation.
  • Warren explains how to run the compiled Java program and encourages participants to confirm their understanding of the setup process.
  • One participant seeks clarification on the term "program," questioning whether it refers to source code or executable files, and receives an explanation about the interchangeable use of these terms.
  • Another participant asks for clarification on the term "smart" in the context of processors, leading to a discussion about the capabilities of physical processors versus compilers.
  • A participant inquires about the relationship between object code and machine code, and the distinction between machine language and assembly language.
  • One participant expresses confusion about the runtime environment and its significance in Java, prompting a detailed explanation of Java's platform independence through bytecode and the role of the Java virtual machine.
  • A participant raises concerns about installation permissions on an office computer and seeks guidance on how to proceed, indicating potential barriers to setting up the Java environment.
  • Another participant asks about the meaning of "launching" an HTML file, which is clarified as opening it with a web browser.
  • A participant requests clarification on what a "convenience file" is and its purpose in the context of Java programming.

Areas of Agreement / Disagreement

Participants express varying levels of understanding regarding key concepts, with some seeking clarification on terminology and processes. There is no consensus on the definitions of terms like "program," and discussions reveal differing levels of familiarity with Java and programming in general.

Contextual Notes

Some participants express uncertainty about specific terms and concepts, indicating a need for further clarification on the distinctions between source code, object code, and machine code. Additionally, there are unresolved questions regarding installation permissions and the implications of using convenience files.

  • #121
I think you can use classes ByteArrayInputStream and ByteArrayOutputStream, which write bytes to or from byte arrays with streams. Then you can utilize the writeObject() and readObject() methods of the stream classes.
 
Technology news on Phys.org
  • #122
There are two classes, ByteArrayInputStream and ByteArrayOutputStream, that place stream interfaces around a byte[] array.

You can use standard Java serialization, writing to such a ByteArrayOutputStream.

- Warren
 
  • #123
Hello, everyoone, i am a linguist teacher studying math as my second degree,
i don't know computer much, i have a little problem writing a java program to draw graph simultanously to reading raw datafrom a file. graph illustrate data read in.
Can u help give me the code or show me how to code it ? I read only a few pages of java2 self study guides.

I hope what you helps me might help someone who searchs a lot these days but unable to find anything.
Thank you very much.
 
  • #124
boteet said:
Can u help give me the code or show me how to code it ? I read only a few pages of java2 self study guides.

Read some more. I doubt very much that you'll get people writing code for you.
 
  • #125
Sorry, although i read , i still can't have time to to finish it because I busy with teaching, my girlfriend needs it, i see she searched internet a lot. i just nneed hints you can tell so i can tell her then.
I need you just give a bit of help for me, please.
 
  • #126
I'm learning Java bymyself using The complete reference of java 2, fifth edition, Herbert Schildt..

I don't use sun's SDK, instead I'm using eclipse..

I was trying to make a small array thingy and here's the code

public class twod {
public static void main(String args[]) {
int twod [][] = new int [4][5];
int i, j, k = 0;

for (i=0; i < 4; i++)
for (j=0; j < 5; j++) {
twod[j]= k;
k++;

}
for (i=0; i < 4; i++){
for (j=0; j < 5; j++);

System.out.print( twod [j] + " "); System.out.println();

}

}


}



And here's the error...
Exception in thread "main"java.lang.ArrayIndexOutOfBoundsException:5
at arrays.twod.main(twod.java:29)

Which is in bold above...It seems to me that the code is correct, i still don't understand what's wrong with the print code..
 
  • #127
Nomy,

The line "for (j=0; j < 5; j++);", just above your System.out.println() call, is wrong. You should not have a semicolon there; instead, you should have an open brace. The semicolon indicates that the for loop is an empty loop, with nothing inside it.

The problem is that a for loop that increments j from 0 to less-than-5 will actually leave the value 5 in the j variable when it's done. The foor loops runs until the condition fails, and the variable j has to contain the value 5 for the condition to fail.

The System.out.println() call is being made -after- the for loop, since the loop is empty. At that point, j contains 5, and you're accessing the array outside its bounds.

- Warren
 
  • #128
Thanks a lot Chroot, now i understand...
 
  • #129
Your algorithm looks like what you did try to implement than it inadvertently turns out to be like that...:biggrin:

Chroot :wink:, I guess nomy wanted to print out the matrix with a semi-colon unfortunately appeared after the second for-loop as an apparent failure for the program to compile, and an exception is thrown right then to indicate the mistake.
 
  • #130
help!

hi, do u have any idea how i can cover the entire screen including the taskbar with an image as soon as a client starts, till a password is provided by the server? The client should not be able to see anything, not even the taskbar till the administrator provides the right password. This has to be done in java... and soon... can u help?
 

Similar threads

Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 33 ·
2
Replies
33
Views
8K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 13 ·
Replies
13
Views
4K