Skip to main content

Posts

Linux awk command

--gsub(r,s) gsub(/0/,23) string icersinde axtarilan 0 deyerini 23 ile evez edir Example1:                  ls -l | awk 'gsub(/0/,23) {print $5} --index(s,t)  index("Arrays","ys") string-in icersinde "ys" axtarilir necenci index-de oldugu qaytarilir Example2:                  ls -l | awk 'BEGIN {print index("Arrays","ys")}'
Recent posts

Declare And Handler-1

Əgər bir xəta yaranarsa program dayanır->thrown created Əgər bir xəta sıfıra bölmə xətasıdırsa,tutulan catch tipi Arithmetic Exception deyilsə,process dayanır, Əgər xəta müəyyən olunub,catch tutularsa program çalışır Məsələn programda xəta meydana gəlir,bu xəta declare(throws Exception) edilib,əgər xəta handler(catch) tutulmasa program dayanır-->thrown created əgər xəta tutularsa process (program çalışmaqda)davam edir

Identify benefits of using ArrayList over array in software development.

ArrayList supports dynamic arrays that can grow as needed. In Java, standard arrays are of a fixed length. After arrays are created, they cannot grow or shrink, which means that you must know in advance how many elements an array will hold. But, sometimes, you may not know until run time precisely how large of an array you need. To handle this situation, the collections framework defines ArrayList. In essence, an  ArrayList is a variable-length array of object references. That is, an ArrayList can dynamically increase or decrease in size. Array lists are created with an initial size. When this size is exceeded, the collection is automatically enlarged.

StringBuilder and String Example

StringBuilder sb = new StringBuilder( "append" ); StringBuilder sb1 = new StringBuilder( "append" ); String s = "append" ; String oldSb = sb.toString(); System. out .println(s==oldSb); //false System. out .println(s==sb.toString().intern()); //true System. out .println(sb1==sb); //false System. out .println(sb1.toString()==sb.toString()); //false System. out .println(sb1.toString().intern()==sb.toString().intern()); //true System. out .println(sb1.toString().equals(sb.toString())); //true

Static Variables and Methods

Static Variables and Methods The static modifier is used to create variables and methods that will exist independently of any instances created for the class. In other words, static members exist before you ever make a new instance of a class, and there will be only one copy of the static member regardless of the number of instances of that class. In other words, all instances of a given class share the same value for any given static variable. We'll cover static members in great detail in the next chapter.    Things you can mark as static: Methods Variables A class nested within another class, but not within a method (more on this in Chapter 8). Initialization blocks    Things you can't mark as static: Constructors (makes no sense; a constructor is used only to create instances) Classes (unless they are nested) Interfaces Method local inner classes (we'll explore this in Chapter 8) Inner class methods and instance variables Local variables They...