87 Topics
|
|
My goal is to create a clone of minesweeper. I've created a custon component that extends the JButton class, for each of the minesweeper buttons. I've called this new class SweeperButton. the game board is going to be made in another class by creating a two deminsional array of SweeperButtons, … |
|
Hi, I am trying to make simple gui which switches jpanel inside jframe but my IDE says "Cannot make static reference to non static method setPage(int) from the type Main". Why is that? There is no static modifier on actionPerformed or at setPage or actually anywhere else than public static … |
|
**Hello i am a noob when it comes to java so sorry if its obvious but the code below is giving me a error when i try to compile it, the error is: Exception in thread "main" java.lang.Error: Unresolved compilation problem: at goodcalculator.main(goodcalculator.java:127). Can anyone help me? ** CODE: import … |
|
Hey guys, I'm a starter so I had a doubt related to placement of a static variable. On line 5, for "static int d=5" compiler issues "illegal start of expression". But when I place it outside main() as Instance variable it works and prints "Hello 5". Why this thing? public … |
|
I'm really confused with this! I have 2 classes, Club and Membership. In Membership I have the method, getMonth(), and in Club I have joinedMonth() which takes the parameter, 'month' - so a user enters a month and then I want it to return the Membership's which joined in that … |
|
I recently converted all my website's files to .php, including my index.html and 404 page. Everything worked fine until I clicked a dead link, and no 404 page came up. Naturally, I figured I forgot to update the .htaccess file. After doing so and re-uploading it, every page on my … |
|
Hello all, been a while since I've asked a question. I'm working on a project just to practice and for fun and I've run into a snag. I'm working on a painting type program and I'm trying to get a generic Buffer class for the images so I can use … |
|
Can any1 help me in differentiating between dynamic and static scoping by using examples ?? |
|
Hi, I have created the following code to get connection object to Database(MySql in my case) using a static method. I wanna know whether it is a good practice or not? Will there be any problem like concurrent access? Any information will be helpful. public static Connection connection(){ Connection conn … |
|
hi, I have two class say class A and class B. Now the methods in class B are used only by class A. When I checked class B, I found that few methods are static and few methods are internal. Can you sugest me is it fine ? Or since … |
|
For anyone working with ID3 version 1 or 1.1 tags in audio files, this static class may come in handy. It uses indexers to convert between the textual to the numerical representation or from numerical to textual and also accounts for unset and invalid values. Being static, it is always … |
|
Hey, I get confused when dealing with the static scope and dynamic scope, and for this pseudocode I have to find both. For static I believe it should print out: 9 4 2 3 however, I'm not entirely sure. Any help would be appreciated, thanks. [CODE]Procedure main g:integer procedure B(a … |
|
I am fairly new to C++ programming and have been working on an assignment for my C++ class that involves writing a dice rolling program (rolls 2 dice). The program is to get a random seed number and a desired number of rolls from the user, keep track of the … |
|
i am newbie to java.i am trying to run a program to show "static method" and "static variable ".my code is below.i am compling it on netbeans 7.01 and everytime i am getting the error.: "main method not found in class static_demo.Static_demo, please define the main method as: public static … |
|
I have a static class, with all methods and fields static. My methods in that class are going to use a static field declared in that class. I want that static variable(which can not be made final) to be initialized with a value taken from a database when that static … |
|
I have a kind of doubt, suppose I have a class like this: [CODE] public class AA{ public static createUser(String a, int b){ User usr=new User(a,b); BB.storeUser(usr); } } [/CODE] Now, if multiple threads call this createUser() method of this class at the same time, will it cause any kind … |
|
What I have is a linksys wrt54gs(dd-wrt) router assigning private ip's to my workstations. I also have a Windows Server which i need accessible for Windows Remote Desktop Connection to my remote office in Costa Rica. I'd like to have the server have one of my 5 static public ip's(so … |
|
Hello, I am using a singleton pattern, which works fine. But when I decided to have a singleton of a nested class that is privately declared. [CODE]class A : public CSingletonTmpl<A> { class B : public CSingletonTmpl<B> { }; }; A* CSingletonTmpl<A>::s_Singleton = NULL; A::B* CSingletonTmpl<A::B>::s_Singleton = NULL; [/CODE] The … |
|
I am trying to make a static library using Code::Blocks and when I make a new static library project it generates a cpp file with functions encased with [ICODE]extern "C"[/ICODE] I am just wondering if this is necessary or if I can write the functions in normal c++ as well. |
|
So I am supposed to write a class that converts fahrenheit to celsius (& vice versa), calculates the volume of a sphere after a radius is entered, and calculates the hypotenuse of a right triangle, all using nothing but static methods. Here is what I have so far; [CODE]class Fun … |
|
Hi! I don't understand why I can't use my functions declared like this: [CODE]#include "groundArray.h" int groundArray::getlistX(int i) { return x; } int groundArray::getlistY(int i) { int groundlistY[] = {100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}; return groundlistY[i]; } int groundArray::getlistWidth(int i) { int groundlistWidht[] = … |
|
Hi, I have a program which has to do a lot of lookup. there are multiple threads running in parallel and all of these threads have to do a lookup on the same list of words. Currently i'm storing the list of words in a dictionary in each of the … |
|
i want to make a program that contains two main classes and they call each other. [CODE]class Main1 { public static void main(String arg[]) { for(int i=0;i<5;i++) System.out.println(i); Main2 m1=new Main2(); } } class Main2 { public static void main(String arg[]) { static int j=0; for(int i=0;i<5;i++) System.out.println(i); if(j==3) break; … |
|
static variable and static function programs. |
|
What will happen? Here's a code that i tried, it works but i don't really get what's actually happening or how many instances of the static test t are getting created. [CODE] #include<iostream> using namespace std; class Test { public: static Test t; void hello() { cout<<"this line shall be … |
|
Hi all, I have a application which is completely written in C++. I got one review comment that normal class methods should not have any static variables and i am advised to move that variable inside class. I want to know what will be advantage of keeping the static variables … |
|
Hi all, I've been doing some reading about calling a non static variable or method from a static context, and almost but not quite have my head around what exactly is going on. I've read the text but can't seem to put that into context, so please bare with me. … |
|
Hey all Allright so here's what I'm trying to do. I'm trying to create about 6 pages into one page. They way that I want it to work is that I will have a navigation bar at the top which when one of the menu items when clicked will direct … |
|
I have some doubt regarding how class variable gets initialized, both static and non static. I mean, suppose I have a class like below. [CODE] public class MyClass{ public static HashMap<String,Buddy> buddiesMap= new HashMap<String,Buddy>(); public static ArrayList<String> buddiesList=new ArrayList<String>(); public static HashMap<String,ImageIcon> avatarMap=new HashMap<String, ImageIcon>(); public static ServerConnection con=new ServerConnection(); … |
|
Hi, I need help with some small exercises. I'll try my best to provide my code but these are ones that I don't know how. So... maybe you can help me with yours! Thanks 1. Question 1: A program contains the following method definition: [CODE] public static int cube(int num) … |
The End.