Amir Kamran

Ranch Hand
+ Follow
since Apr 21, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Amir Kamran

well carry on as the teacher instruct you
but if you are interested you can find material on parsing and context free grammars easily on net

here i can give you some idea how things works

any equation follows a particular syntax for example if I say in my system all equations are of type
"operand operator operand"
and lets say operator means + and *, and operand is any number
now for example the input comes 2 + 2 it follows the above rule
and if input comes 3 * 5 it follows the above rule

in short the above rule defines a grammar and all equations of above type follows that grammar

now what i need to do is write a program that can parse the grammar "operand operator operand" and I am able to parse all equations of this type weather its 10 + 9 or its 100 * 300 whatever

its a really interesting subject building grammars, parsers, compilers ...
17 years ago
whenever some software installs on windows operating system it adds some information in the windows registry...So the first thing you need to know which registry entries a particular software adds to the windows registry.
than you can easily read information from windows registry using java.util.prefs.Preferences class
17 years ago
hello!

the given code suggests that you are trying to write a parser for simple equations and the example (add 4 (mul 4 6)) suggests that the equations are in prefix notation

if this is the case than its very simple split your string use the braces as delimiters because in prefix and postfix notations braces are of no use

String [] tokens = input.split("(|)");

this will break your string like this
tokens[0] = add
tokens[1] = 4
tokens[2] = mul
tokens[3] = 4
tokens[4] = 6

but if you really want to write a parser for all kind of equations you need to implement context free grammars.
17 years ago
hello!
all the static initializers run before the constructors ... for example if C extends B and B extends A ... and A , B , C all have static initializers and if we instantiate C then first static initializer of A execute then of B and then of C .... then all constructor first A then B and then C .
hello!
the precedence of bitwise operators is more than short circuit logical operators
so
(x>3) && (y<2) | f
means
(x>3) && ((y<2) | f )
for complete list of operator precedence check out this linkhttp://mindprod.com/jgloss/precedence.html
hello!
what i understand is that ... ur doing overloading here not overriding ... so your methods will not show polymorphism
when u call
c1.m1(c2)
here c1 is of type A and the passing argument is of type C
and because in m1(A a) of class A, an instance of C can be passed in m1(A a) as C is a subclass of A
so it prints A
hmm...
SuperClass bc=new BaseClass();
this will not compile because of the same reason of accessibility ... we have to provide a public or protected constructor to instantiate a class in different packages.
hello!
first of all serializble is not a class its an interface.
Java Object serialization allows us to take any object that implements the serializable interface and turn it into a sequance of bytes that can later be fully restored to regenerate the original object.
for more information on serialization check out this article
web page
hello !
There is no confusion at all dear.
when you use no access modifier, only the classes with the same package can use the methods.
you are using two different packages, so the subclass not inheret the static doTest() method of superclass
Hello Again!
To study JSP what I think one should have some idea of Java and Servlet programming and also familiarity with the terms web Application, Web Server and Web Container etc. In every JSP and Servlet book there is some description on these topics.
Well I can give u little knowledge about these things:
A Web Application is a collection of Java Servlets, JSP pages other helper Classes, Static Resources such as HTML or XML documents, images etc.
A Web Container is basically a java runtime providing an implementation of the Java Servlet API, and other facilities for JSP pages. The web container is responsible for initializing, invoking and managing the life cycle of Java Servlets and JSPs.
Tomcat is a web container, which follows a particular directory structure for each web application. i.e. u have to store ur web application in the folder of webapps and in each web application there is a WEB-INF folder, which contains the classes folder. The Servlets and other java files are stored in the classes folder. While the JSPs can be store any where outside the WEB-INF folder. If u not follow this directory structure tomcat not recognize ur folder as a web application.
In the book �Java Servlets Developers Guide� there is a complete chapter on tomcat and webapps. Thanks to Javaranch I won this book from here.
Well, in ur program the folder myJSPs is actually ur web application, so u must have a folder of WEB-INF in it which contains the folder classes in which u store all ur java classes or packages. Store ur jsp file any where in the myJSPs folder but outside the WEB-INF folder.
I hope u understand all what I m talking about.
21 years ago
JSP
Hello!
what i find out, what ur doing wrong is first of all in the java file dont define that it is in a package, the first line of ur java file must be
package Hour8;
Secondly, the web application u created in webapps is myJSPs where u store ur jsp file in the same web applicaion in WEB-INF/classes folder store ur package Hour8 which contain ur java file. i.e.
D:\tomcat\jakarta-tomcat-3.3.1\webapps\myJSPs\WEB-INF\classes\Hour8

I think this will solve ur problem.
21 years ago
JSP
It is not recomended for new programmers to use an IDE specially for learning and certification point of view.
One of my java teacher says, "Dont use an IDE untill ur eyes became a compiler."
What all of u think ?
These are the IDES nominated for the 2002 javaworld Editors' Choice Awards:
Forte for Java 3.0, Sun Microsystems
IDEA 2.5, IntelliJ
JBuilder 6.0 Enterprise, Borland Software

The best IDE is the one which fits with ur style of coding. some points to choose an IDE are :
+ it is platform independent, especially if you choose an IDE which is written in Java
+ it may deal well with large projects with many files
+ it may provide a sophisticated debugging system
+ it may be properly integrated, convenient and efficient
+ it may not force you to use its editor rather than your favourite
+ it may not using a lot of resources
+ it may not be complex, with a steep learning curve
+ it may not confuse or distract beginners
+ it may not concentrate on the wrong issues, e.g. GUI design rather than object oriented program design
+ it may not decrease your productivity, unless you use it full-time
Hello!
David Hemphill and James White
Is J2ME is only for mobile technology?
21 years ago
Hello to All!

Welcom Bruce!
Can u describe the title page with an old man.
What kind of patterns the book cover.