Help coderanch get a
new server
by contributing to the fundraiser

Saraswathi

Greenhorn
+ Follow
since Sep 15, 2003
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 Saraswathi

hi,
The compiler gives the error saying
non-static variable x cannot be referenced from a static context System.out.print(x);
becoz x is a class variable and without creating an instance of it you cannot access it .
class xxx{
int x;
public static void main(String ar[]) {
xxx alpha=new xxx();

int y=0;
System.out.print(y);
System.out.print(alpha.x);
}
}
This works fine . and you need to initialize y to a default value.

OR
class xxx{
static int x;
public static void main(String ar[]) {
//xxx alpha=new xxx();

int y=0;
System.out.print(y);
System.out.print(x);
}
}

If the variable x is declared as static then also the code works fine.

They are the rules you see.
hope it helps.
20 years ago
HI.
I HAD SAME FEELING 2 MONTHS AGO, BUT LUCKILY I HAVE HUSBAND WHO IS ALSO A JAVA PROGRAMMER , TO HELP ME OUT . AFTER BEING IN TO JAVA FOR 2 MONTHS , FROM MY EXPERIENCE I CAN TELL YOU , GO THOUGH THE JAVA TUTORIAL , UNDERSTAND AS MUCH OR EVEN LITTLE AS POSSIBLE DO THE PROGRAMS GIVEN BETWEEN THE TUTORIAL . AND ALSO TRY WRITING PROGRAM TO ADD 2 NUMBERS OR MULTIPLY OR ACCEPT INPUTS AND DISPLAYING THEM.
TRY USING METHODS TO DO SOME OF THE CALCULATIONS . AFTER LITTLE PRACTICE OF PROGRAM ONCE AGAIN GO THOUGH TUTORIAL , U WILL UNDERSTAND MUCH BETTER THIS TIME .
THAT'S MY OWN EXPERIENCE TOO.
HOPE THIS HELPS.
GOOD LUCK
20 years ago
hi ,
I am new to java programming , and may not be able to explain the very detail of your programs mistake but ofcourse give u the solution.

first: [index] ---------------

You need to give the the variables that describes the dimensions i.e [x][y],
like this
sum = sum + twoArray[x][y];
second: sum and count variables are not initialized to 0 .

third : + operator will be cleared if you change the word index to [x][y].
Hope it helps
Thank you.
Good Luck.
20 years ago
hi,

Multiple inheritance is a way to inherit some properties , methods from the different classes(many parent class ).

i think, Interface concept is lot easy to understand write and implement .It does the same as multiple inheritance , but in a better way.
GOOG LUCK.
20 years ago
hi there,
I would like to know which is the best source(books) to study for the fisrt basic Java Certification.And what exactly is the method to prepare.
THANK U.
20 years ago
can you add a component like a button (JButton ) to the JTable.
If there is data that we want to arrange in row column arrangement, and also buttons that has to be included in the same row and column . how can it be done?
According to me we cant add any other component , but i would like to know if at all there is a way.
THANK U.
20 years ago
when we create packages of our own, where is it supposed to stored and accessed?
20 years ago