Skip to main content

Questions tagged [static]

The static keyword, in object-oriented programming languages, is used to define a function/method or field/property as bound to the context of a type/class, but not to any specific instance. Unlike constants, static properties can usually be changed at runtime. static also refers to the storage class in languages like C. static variables are initialized once, at run-time, and persist in between function calls (i.e. they aren't re-initialized).

Filter by
Sorted by
Tagged with
0 votes
3 answers
613 views

How to overcome static referencing errors in Java/basic programming?

Someone posted a question on http://math.stackexchange.com earlier because their program to tranpose a matrix wasn't working. I copied the code they posted (which was just the transpose method) and ...
George Tomlinson's user avatar
0 votes
1 answer
620 views

Usage of static block vs. direct static variable initialization [closed]

Suppose, I have a data access layer class, where I want to specify database connection parameters. Usually, I do it as static variables and initialize it right after definition, e.g. see ...
Mike's user avatar
  • 277
0 votes
2 answers
294 views

Initializing a big static array for a card-based iOS app

I have a card-based iOS app that uses a sizable static array of cards. Each card has several properties, mostly strings, numbers and boolean. The first version of this app had 3-4 properties. The ...
Zonker.in.Geneva's user avatar
0 votes
1 answer
66 views

Logging util with static lambda function

So again, I am a bit confused about some notes that i'am getting from my reviewer. I have some kind of utils, to print/prepare log messages. Yea, maybe I am a bit fanatic java 8 lambda guy but I think ...
shutdown -h now's user avatar
0 votes
1 answer
620 views

Class for finding the median of a two-dimensional space

I have a simple static class that it's purpose is given an RDD of Point to find the median of each dimension and return that as a new ...
Aki K's user avatar
  • 1,329
0 votes
1 answer
122 views

Improving poor man's translations mechanism in c++98 program

In order to add basic translation capabilities in an old c++98 program I've come up to a basic and shameless code summarized by this snippet: ...
MatG's user avatar
  • 149
0 votes
1 answer
1k views

C# API Wrapper with Static Function Calls

I'm creating a wrapper library for an API, and I hit a block on how to redesign it. The entire library is static, and I'd like to change it to make it more testable. The library's goal is to make ...
user avatar
0 votes
1 answer
118 views

YUIDoc syntax for optionally static constructor

In JavaScript, I wrote a class that can be optionally instantiated with the new keyword, but can also be called statically as well. What is the best way to ...
Patrick Roberts's user avatar
0 votes
1 answer
91 views

Generically call static methods

I currently have two (core) classes : ...
WynDiesel's user avatar
  • 145
0 votes
1 answer
3k views

Using UnitOfWork/Repository pattern in static class/methods

I know using a UnitOfWork/Repository pattern in a normal class should work fine without any issues but how about using them in a static class/methods (I mean using a private static IUnitOfWork ...
user27695's user avatar
0 votes
2 answers
275 views

Read employee number and salary (exercise to use static keyword)

WAP to create a class called Employee having empid and salary as data members and salary as data members. Create objects of this class and count no. of employees working in an organization using ...
Ravi Singh Lodhi's user avatar
-2 votes
1 answer
103 views

Updating contacts in mobile phone simulation

I'm currently making a mobile phone simulation, using a custom object in an ArrayList. I was wondering if there was any difference in using these two following ...
PacketSniffer's user avatar

1 2
3