How do i make jar files smaller?
Java's default jar application only comes with two options for file size: compressed or uncompressed. If that compression isn't enough for you, you may want to look into third-party solutions to actually decrease code size.
The Java method printf is based on the?
Java doesn't have a printf method. To provide the implementation of printf method of C in java, the java has two print methods. They are
1. print()
2. println()
The first method prints the text in braces on the same line, while the second is used to print on the next line. In fact, ln in println() stands for next line. We need not use /n while working in java.
Actually, the System.out.format() function is practically identical to printf in C. When translating code from C to Java, you can generally replace all calls to printf(args...) with calls to System.out.format(args...).
...and to answer the original question, Java's System.out.format() method is based off of C's printf() function.
You can check out the Arrays.binarySearch group of methods for searching sorted arrays. There is no predefined linear search for arrays, probably because it is trivially easy to implement.
If you have some other data structure to search, the Collections.binarySearch methods should work for you. Most collections can also be converted to a List representation, which has a predefined indexOf method for linear searching.
Abstraction
Abstraction is simplifying complex reality by modelling classes appropriate to the problem, and working at the most appropriate level of inheritance for a given aspect of the problem.
For example, Lassie the Dog may be treated as a Dog much of the time, a Collie when necessary to access Collie-specific attributes or behaviors, and as an Animal (perhaps the parent class of Dog) when counting Timmy's pets.
Abstraction is also achieved through Composition. For example, a class Car would be made up of an Engine, Gearbox, Steering objects, and many more components. To build the Car class, one does not need to know how the different components work internally, but only how to interface with them, i.e., send messages to them, receive messages from them, and perhaps make the different objects composing the class interact with each other.
More simply,
Abstraction is to represent essential features of a system without getting involved in the complexity of the entire system.
The process of reducing an object to its essence so that only the necessary process of reducing an abject to its essence so that only the necessary element are represented abstraction defines an object in terms of its properties(attributes),behaviour(functionality), and interface.
Can Array List in java hold different data types?
No, we cant hold different data types in an Array. But using Array List we can hold any data type as a Object. But you need iterate that values as a Object and again you need to convert those values into the different data types accordingly.
In order to write compile and execute java programs in my PC which software should i install?
Compilation (byte code conversion) and execution (interpretation) of JAVA programs requires a JAVA Compiler and a JAVA runtime. There are many JAVA development systems available, some free, some not free. Two vendors for the PC / Windows platform are Sun and Microsoft, but, again, there are others.
University solved slips for third year bsc computer science?
The university solved slips for third year Bsc Computer Science are usually issued after the students satisfy the conditions set out by the examination body. The students also have to meet the conditions set out by the senate.
Why Java is called strongly typed language?
A strongly typed programming languages is one that requires the type of a variable to be explicitly stated. C is a strongly typed language. You must declare the type of data a variable will store for C to interpret it: int myVariable;
myVariable = 25; Perl is a loosely typed language. There is no need to declare the variable type before using it: $myVariable = 25;
$myVariable = "A String.";
I dont know someone plz tell me what it eats and its habitat,niche,what it eats drinks is it posionous lots of questions
How to generate control flow graph from Java code?
I use Control Flow Graph Factory to generate control flow graphs from Java methods.
http://www.drgarbage.com/control-flow-graph-factory-3-5.html
Best,
Paul
Definition of event handling in java?
When an application or a program keeps on monitoring and quickly responds to any action that occurs at the GUI interface ,like mouse movement, selecting an item in a list or entering a keyboard input and so on then such a scenario is termed as event handling.
In java the events from the event sources are captured and they are sent to event listeners for respective actions to be taken.
Different platforms required to have different type of JVM yes or no give reason?
because every thing in java deals only with java like ,
1.reference to class in assinging parameters
2.object can be called as parameters
3.we can also return the objects in java
if u have still doubt in mind then u can as
Important points of oops vs pop in java?
java is object oriented language.it's a platform independent.in java we don't use pointers
MVC stands for Model View Controller. This is a framework that is commonly used in Java applications where we separate the UI, data and processing logic from one another. Model stands for the Data View stands for the UI Controller stands for processing logic By separating these 3 items, we would be able to modify each of these independently and have an application which is much more robust and easier to maintain than normal frameworks.
What is the difference between paint and repaint methods of java?
The paint method is where actual painting occurs. If you want to change the way a Component is drawn, you should override this method.
The repaint method typically just tells your Component that it should call its paint method as soon as it can. This is the method you should call to force a Component to update itself. The Java API warns not to ever directly call the paint method, mostly for efficiency reasons.
Programming Random numbers without repetition of numbers in java?
Since you (hopefully) can't predict random numbers in Java, we'll need to store the numbers that we've generated so far. A Set seem ideal for this, as it automatically handles keeping itself free of duplicates. The problem is that the order in which elements are removed from a set are not guaranteed to be in the same as the order in which they were added. I would suggest using a List of some sort:
// returns a List of n random integers from 0 to max
static List<Integer> getUniqueRandomInts(final int n, final int max) {
// if n > max, this function would never return, so remove the possibility
if (n > max) {
return null;
}
// new list of values
final List<Integer> list = new ArrayList<Integer>();
// seed our random generator with the current time
final Random rnd = new Random(System.currentTimeMillis());
// keep trying to add numbers until we have the proper number
while (list.size() < n) {
int num = rnd.nextInt(max);
if (!list.contains(num)) {
list.add(num);
}
}
return list;
}
What are the advantages of traditional file system?
Though traditional files have been already replaced with the more conventional and easy way of organizing files (DBMS) it still has some pros versus the latter system...
In the traditional filing,
...there is not much requirement when it comes to facility. Just a space for the different files and you're good to go.
... traditional filing is user friendly and only little training is required for this. The only thing needed is just pure sence of organization, initiative and value for ones files and documents.
...in the end, nothing beats a hard copy for every one to see or review. Since not everyone has the skills to operate an advance system nor have the ability to keep up with these modern changes.
What are the only types in Java that are not classes?
The non-class Java data types are primitives:
* byte * short * int * long * float * double * boolean * char
What is difference between library and package in java world?
A library is a set of classes or modules with methods that are intended for use by other programs. An example is the Math library.
Libraries are organised into packages. For example, the java.lang package includes the Math library among alot of others.
As a side note, a library can be just one class, but that class usually has multiple methods/modules that are used by many other Java programmers.
There are basically three types of programming errors. 1) logic errors, where conditions or variables are not described correctly, and a result does not follow according to the rules of logic. For example, allowing a condition of "pregnant=yes" and "gender=Male" to exist. 2) syntax errors, where a variable is misspelled or a function is used incorrectly, leading to an error in compilation because the computer doesn't understand your statements. An example of this is misspelling a function name or assigning a wrongly typed variable, for example a string to a number or something like that. 3) design errors, where a flaw in the algorithm or a mistake in the flow of processing causes an incorrect or incomplete result to be determined. In other words, something like forgetting to allow for sales tax in an invoicing system or the like.
Why is event handling in java not working in Linux?
It is working, so you may have made an error, or your JRE/JDK version is too old, or whatever else.
How do you find by program a given number is integer or float?
If it contains a decimal point or an exponential part, then it should be handled as a float (or double).
You can determine an existing variable's type in C using the type() function
Name the following-A package that is invoked by default?
The java.lang package is invoked by default by all Java classes. We need not import the classes inside the Java.lang package inside our class. They are automatically imported into all Java classes.
Example: java.lang.String
If you have to declare an array list the import statement import java.util.ArrayList; must be there in your class declaration. If this import is not present your code using the ArrayList would not compile or work
But if you are going to use a String, you can directly use it because it would be automatically imported.
Which language do you use if you are creating an application to be deployed via a network?
Deployment methods are not integral to any programming language. You can use any suitable programming language to write the actual program, but how you deploy it is entirely up to you. However, there are installation tools that can assist with your deployment strategy.