How do you call repaint using thread in java applet?
You call the repaint method the same way you'd call any other method from a thread.
final Applet appletToRepaint;
new Thread() {
public void run() {
appletToRepaint.repaint();
}
}.start();
Which one is not an example of a method of determining an IMDC location?
IMDC uses a compass, radio or satellite to determine their location.
To import a class in a program, you typically include an import statement at the top of your code. The syntax for importing a class is: import package_name.class_name;. For example, if you want to import a class called "Person" from a package called "com.example", you would write: import com.example.Person;. Once the class is imported, you can use it in your program by creating objects of that class or accessing its static members.
public static final String convertString(final String stringToSearch) {
// text representation of digits
final String[] digits = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
// the new version of stringToSearch, as we convert digits
StringBuffer convertedString = new StringBuffer();
// delimeter for splitting up the string
// - change this if you need to parse on more characters
final String delim = " ,.?!\t\n\r\f";
// parse using StringTokenizer for simplicity
StringTokenizer parser = new StringTokenizer(stringToSearch, delim, true);
// iterate through tokens
while (parser.hasMoreTokens()) {
String currentToken = parser.nextToken();
// if currentToken is a single digit, convert it to text
if (currentToken.matches("\\d")) {
currentToken = digits[Integer.parseInt(currentToken)];
}
// append converted text to convertedString
convertedString.append(currentToken);
}
return convertedString.toString();
}
Write a program in Java which will print all nested loop between 1 to 500?
Sure! Here's a Java program that will print all the nested loops between 1 to 500:
public class NestedLoopExample {
public static void main(String[] args) {
for (int i = 1; i <= 500; i++) {
for (int j = 1; j <= 500; j++) {
System.out.println("i=" + i + ", j=" + j);
}
}
}
}
This program uses two nested for loops to iterate from 1 to 500. It prints the value of i and j for each iteration of the loops.
What are different Constructor and finalize in java?
These are two unrelated concepts. A final object is one that is not subject to inheritance (in the case of a class), may not be overridden (in the case of a member function), or not subject to change once set (in the case of an instance of a class). A constructor allows an instance to be loaded with values when the object is created. A final member variable may be set only once, and may never be altered after that point. This can eliminate certain classes of programming bugs. For example, java.lang.Math.PI should never change (it is a constant value), so accidentally assigning a value to this symbol should result in an error.
The scientific method is a process for creating models of the natural world that can be verified experimentally. The scientific method requires making observations, recording data, and analyzing data in a form that can be duplicated by other scientists. In addition, the scientific method uses inductive reasoning and deductive reasoning to try to produce useful and reliable models of nature and natural phenomena. Inductive reasoning is the examination of specific instances to develop a general hypothesis or theory, whereas deductive reasoning is the use of a theory to explain specific results. In 1637 René Descartes published his Discours de la Méthode in which he described systematic rules for determining what is true, thereby establishing the principles of the scientific method.
What is the class of Arachnoidiscus?
Arachnoidiscus belongs to the class Bacillariophyceae, commonly known as diatoms. These are a group of photosynthetic microalgae characterized by their unique cell walls made of silica, which form intricate patterns and shapes. Arachnoidiscus diatoms are known for their radial symmetry and ornate patterns, making them visually appealing and often studied in microorganism research.
What is difference between String str and String s equals new String?
Btw, this is a C++ question.
in 'String str', str is an object and most probabily (based on most String implementations) we can use
str = "my name";
int len = str.length();
String s = new String; <== this is something wrong.
it should be
String *s = new String;
here 's' is a pointer and the object is allocated/instanciated by 'new' operator
you can use it
*s = "my name"
int len = s->length()
How do you declare an array of buttons in Java?
To declare an array of buttons in Java, you would use the following syntax:
Button[] buttonArray = new Button[n];
where n is the number of buttons you want in the array. This creates an array of n buttons, where each element can hold a reference to a Button object.
Why symbol of java is coffee cup?
There's no consensus on how coffee got the nickname "a cup of joe," but there are a bunch of theories, some way more plausible than others. The most likely is that other nicknames for coffee—"java" and "mocha"—got smushed into one word, "jamoke," which got shortened to "joe" over time.
The next theory in terms of plausibility is that "joe" has a long history of standing in for the common man, and since coffee came to be the common, everyday beverage, the two were a natural fit.
There are other popular theories—like the one claiming "joe" is an homage to Josephus Daniels, who banned alcohol on Navy ships in the early 1900s and thus sparked an uptick in coffee consumption among the crews—but they're not very well proven.
Not at all. Minecraft REQUIRES Java. If you don't have it, sorry!
It is also important when downloading Java to play Minecraft to understand whether you need the 32-bit or 64-bit version for your computer. For more information regarding this check out the guide I have included in the Related Links section below.
What is the difference between java.io.BufferedWriter and java.io.PrintWriter?
A FileWriter is used to send output to a file. A BufferedWriter uses an output buffer to help increase performance when writing to a file or sending information over a network.
These two classes are often used in conjunction with each other:
BufferedWriter out = new BufferedWriter(new FileWriter("myFile.txt"));
What is a delimiter in programming?
It is something used to delimit - mark - something that isn't program code. It is most often used to refer to strings. The delimiters for strings are most often " ", and ' '.
A delimiter is a sequence of one or more characters used to specify the boundary between separate, independent regions in plain text or other data stream. An example of a delimiter is the comma
How do you change a ZIP file into an Executable Jar File?
Try using Launch4J to achieve that. But keep in mind that resulting .exe will be able to run only on Windows platform, whilst Java itself allows launching jars on any platform it supports, including Linux, Solaris, BSD, etc.
jar files are basically zip files with an extension of jar. If you just want to view the contents of the file, you may use programmes like winzip or winrar etc.
But if you want to use the jar file for some execution you should j2me, or sjboy emulator
Which is more good to use for loop or while loop?
The main difference comes into picture when you use continue with them i.e. for and while.
In a while loop if continue is used before the increment of a variable is done it converts into a infinite loop.
i=1;
while(i<10)
{
/* do stuff */
if(i==6);
continue;
i++;
}
The above piece of code will turn into an infinite loop.
for(i=1;i<10;i++)
{
/* do stuff */
if(i==6);
continue;
}
In the above for loop the value of will be incremented once it attains the value 6.
Therefore it will not turn into a infinite loop.
Cheers.
astvansh> 'for' statement takes the start condition, stop condition, and the increment. 'while' statement just takes the stop condition.
One scenario (which i can think of) where while 'needs' to be used rather than a for, would be when the counter needs to be incremented/decremented conditionally...
string[] arr = {"a", "b", "b", "c"};
int i = 0;
while( i< 10)
{
// do something constructive
if(arr[i] == "b")
{
i = i + 2;
}
else
{
i++;
}
}
Cheers,
Ajeesh
Another main difference between the two: a 'for' loop is called a determinate loop, meaning that we usually use it when we know ahead of time how many iterations we want. The 'while' loop is an 'indeterminate' loop, because we usually use it in situations where we do not know the number of times the loop may iterate.
Give 5 real life example of stacks?
a) The processing of procedure calls and their terminations in computer programming. b) Arrangement of granules in chlorophylls. c) Arrangement of Plates on over another. The plate at the bottom of the plate hype is washed and kept first but, it is used or comes out last. d) Chapattis cooked first are placed at the bottom in the Tiffin and the last cooked id at the top in the Tiffin. e) Arrangement of chairs on over another. The chair which is put in first lies last when comes out.
Installation method of java games in samsung s5603?
how to install games in samsung (universal :p) 1. Create a new text document(on desktop right click > new > text document)
2. In that paste this.
<html><body><a href="_______">install _______</a></body></html>
#Write ur application/software/game name in the space provided.
for example
<html><body><a href="operamini.jar">install operamini.jar</a></body></html>
#Here operamini.jar is name of the application/software/game that is going to get installed.
#Remember that the name of the application/software/games should be same with that u write here.
#If your .JAR file name is operamini.jar then in the space provided you should type operamini.jar
3. Now rename that file to abc.html and copy both the files (''abc.html'' and the file you want to install) to a folder via Cable to the phone.
4. open abc.html in ur phone and the file you want to install is installed
Platform means the hardware and software the computer is using. It is also called "the operating system" or "OS".
What are the steps of encapsulation?
Encapsulation is the process of adding header information to the layers' data "payload". As the "payload" is passed from one TCP/IP (or OSI) layer to the next, encapsulating layer information is wrapped around the data. So, for example, if the application layer produces a data payload for transmission, it encapsulates it with application-layers headers, which then gets passed to the presentation layer. The presentation layer does the same and so down the protocol stack before transmission across the physical media. At the destination, the process is reversed by way of de-encapsulation where the headers are stripped-off by each matching layer at the destination.
1. Application, Presentation and Session layers create data. {Encapsulation headers added by layers}
2. Transport layer coverts data into segments for transport across the network. {Encapsulation headers added by layer}
3. Network layer converts segments into packets (or Datagrams). {Encapsulation headers added by layer}
4. Data Link layer converts packets (and datagrams) into Frames and the Data Link header is added. {Encapsulation headers added by layer}
5. Physical - frames are converted into bits for transmission over the physical media.{Encapsulation headers added by layer}
How do you convert a while loop to do-while loop?
A for loop is classified as an iteration statement. A simple example might be...
For x = 1 To 10
'loop body
Next x
The same loop expressed as a while loop (classified as a control flow statement) could be...
x = 0
Do While x < 11
'loop body
x = x + 1
Loop
.