sandy chops

Greenhorn
+ Follow
since Nov 11, 2010
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 sandy chops

Yes bytecodes contains zeros and ones, if use the below command and try to get generate the bc of the java file you will see the internal details.

Create a testing.java file with just main method in it.
javac testing.java

This will create .class file, then using the below command create the bytecode
javap -c testing > testing.bc

Its will be as below

Compiled from "testing.java"
public class test.testing extends java.lang.Object{
public test.testing();
Code:
0: aload_0
1: invokespecial #1; //Method java/lang/Object."<init>")V
4: return

public static void main(java.lang.String[]);
Code:
0: getstatic #2; //Field java/lang/System.out:Ljava/io/PrintStream;
3: ldc #3; //String hello world
5: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
8: return

}

When you inspect the bytecode some opcodes are prefixed with a. For example at line 5 aload_0, The prefix is representative of the type that the opcode is working with. The prefix `a' means that the opcode is manipulating an object reference. The prefix `i' means the opcode is manipulating an integer. Other opcodes use `b' for byte, `c' for char, `d' for double, etc. This prefix gives you immediate knowledge about what type of data is being manipulated.

JIT is part of the JVM and is used to speed up execution time, it helps comoile parts of the bytecode that have similar functionality at the same time and reduces the amount of time needed for compilation. Basically its purpose it to take generic bytecode and compile them into more machine specific instructions.

hope this helps
12 years ago
Method chaining is best suited if the methods return type is void.

Otherwise its difficult to debug and understand.

12 years ago
hi Pramod,

If you don't want to use while loop, and if the file size is less then Integer.MAX_VALUE you can use below code


FileInputStream fin = new FileInputStream(file);

Create a byte array to hold the data of the file

byte data= new byte[(int)file.length()];

fin.read(data);

after this you can create a string out of the bytearray and print it or use it.

by this method you don't need to use while loop.

hope this helps
12 years ago
Try this it will help clear your doubt.

12 years ago
check getTime() , Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.
12 years ago
Arraylist, constructs an empty list with the specified initial capacity.
It uses the object[] array buffer to store the elements.
if no initial capacity is specified a empty list with capacity of 10is created.


As new items are added to Arraylist, it checks the array size and if there is empty space it copies it there else a new large array is created. and old array is copied to the new one.
elementData = Arrays.copyOf(elementData, size, Object[].class);

Further details check ArrayList.class.
12 years ago
Here is my take on this.
This is how java supports polymorphism using method overloading, "one interface, multiple methods paradigm'
One benefit of overloading is that you can access related methods by using common name.
Also when an overloaded method is invoked, java uses the type and/ or number of args to determine which method to actually call.
This avoids coding error if there are different methods names and a wrong method is coded by the programmer.
hope this helps.
12 years ago
WSDL is an XML-based language for describing a web service.
Soap is specification and REST is a stype.

REST and WSDL are not related.
13 years ago