Posted: Sun Sep 14, 2003 11:41 am Post subject: (No subject)
what packages do you need to import? That code does not look like any familiar code to me.
based on the following i presumed it was javascript.
you variables are not declared but directly defined.
screen.write(""); is something i'm sure java does not have.
anyways.. you might be using what is known as bsh or the bean shell.
i don't know much of the bean shell syntax. but it's supposed to be the Java scripting language. Technically any valid java code is a valid beanshell code. but not the other way round.
but if it is java that code won't compile. (as i said what packages do i need to import?)
Sponsor Sponsor
w0lv3rin3
Posted: Sun Sep 14, 2003 2:16 pm Post subject: (No subject)
here is full code from a program I was pratcing on:
packages needed are avi.*
code:
import avi.*;
code:
//this is line comment for the human eye
//the compiler completely ignores comments
/*this is a block comment and allows you
* to put block comments. Use this style
* when you need more than a line comment
*/
//import java.lang.*;
import avi.*;
public class Hello //class name
{ //the beginning of the class definition
public static void main(String[] args)
{
Window screen = new Window("Testing","bold+italics","red",30);
DialogBox inNumber1, inNumber2;
//can do it in a seperate statement
inNumber1 = new DialogBox(screen,"Input first integer");
inNumber2 = new DialogBox(screen, "Input second integer");
int number1, number2, sum, difference, product, remainder;
float quotient;
float fnum1 = 3.1f;
double dnum1 = 3.3;
short snum1 = 2;
long lnum1 = 3;
char cnum1 = 'q';
boolean ans = false;
int example1 = 3/2;
float example2 = 3/2;
//how to do the right arithmetic
float example3 = 3.0f/2;
//alternative way
float example4 = (float)3/2;
float example5 = (float)3 / 2 + 4 * 6;
double example6 = 3.0/2;
final float PI = 3.14f;
//these two statements can replace the above statement
//final float PI;
//PI = 3.14f;
//the next statement will give compilation error
//PI = 2.3f;
dnum1 = fnum1;//this is allowed
fnum1 = (float)dnum1;//this is not allowed, want to do it
number1 = 10;
number2 = 5;
screen.showWindow();
//we will now use DialogBox class to take input
//instead of hard coded data
inNumber1.showDialogBox();
number1 = inNumber1.getInteger();
inNumber2.showDialogBox();
number2 = inNumber2.getInteger();
screen.write("\nHello to all of you");
// System.out.println("Hello to all of you");
}
}
rizzix
Posted: Sun Sep 14, 2003 9:20 pm Post subject: (No subject)
o ok.. ur using non-standard packages.. ur ehm.. college provides.
thats cool. although you can learn java with the standard packages.
nate
Posted: Mon Sep 15, 2003 9:48 pm Post subject: (No subject)
for a college student you sure don't know your grammar.
Quote:
ur a biggest newb
Tony
Posted: Mon Sep 15, 2003 9:59 pm Post subject: (No subject)
yeah... there should be a rule that when you post java code that implements non standart packages, please include all the "include..." lines so the rest of us wouldn't have to guess
maybe rizzix should write it up, he knows Java better then I do
Posted: Wed Sep 17, 2003 4:27 pm Post subject: (No subject)
yea i'd agree tony. there are far too many java-like scripting variants that look similar to java. it get's pretty confusing at times. I mean java code is 100% bean shell compatible yet not the other way round (i.e bsh code is not 100% java compatible). speaking of which do check out this awsome scripting language @ www.beanshell.org .. and don't be to hard on that dude, he probably got offended for some reason