Set the Size of a Vector in Java

Arushi
Updated on 30-Jul-2019 22:30:24

571 Views

The java.util.Vector.setSize() method can be used to set the size of a Vector in Java. If the new size that is set is greater than the old size of the Vector, then null values are added to the positions created. If the new size that is set is lesser than the old size of the Vector, then the elements at positions more than the new size are discarded.A program that demonstrates this is given as follows:Example Live Demoimport java.util.Vector; public class Demo { public static void main(String args[]) { Vector vec = ... Read More

Why Final Class is Used in Java

Vikyath Ram
Updated on 30-Jul-2019 22:30:24

1K+ Views

The final keyword is used with a class to create a final class. The final class cannot be inherited and so the final keyword is commonly used with a class to prevent inheritance.A program that demonstrates a final class in Java is given as follows:Example Live Demofinal class A {    private int a = 9;    public void printA() {       System.out.println("Value of a = " + a);    } } public class Demo {    public static void main(String args[]) {       A obj = new A();       obj.printA();    } }OutputValue of ... Read More

Fill Elements in a Java Long Array in a Specified Range

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

172 Views

Elements can be filled in a Java long array in a specified range using the java.util.Arrays.fill() method. This method assigns the required long value in the specified range to the long array in Java.The parameters required for the Arrays.fill() method are the array name, the index of the first element to be filled(inclusive), the index of the last element to be filled(exclusive) and the value that is to be stored in the array elements.A program that demonstrates this is given as follows −Example Live Demoimport java.util.Arrays; public class Demo { public static void main(String[] argv) throws Exception { ... Read More

Select INT as Currency or Convert INT to Currency Format in MySQL

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:24

552 Views

To convert int to current format, use CONCAT() with FORMAT() function from MySQL.The syntax is as follows −SELECT CONCAT(‘CurrencySymbol’, FORMAT(yourColumnName, valueAfterDecimal)) as AnyVariableName from yourTableName;To understand the above syntax, let us create a table. The query to create a table −mysql> create table AddingCurrencySymbolDemo −> ( −> Amount int −> ); Query OK, 0 rows affected (1.50 sec)Insert records in the table using insert command. The query is as follows −mysql> insert into AddingCurrencySymbolDemo values(250); Query OK, 1 row affected (0.22 sec) mysql> insert into AddingCurrencySymbolDemo values(500); Query OK, 1 ... Read More

What is Sharing, Blogging and Publishing

Knowledge base
Updated on 30-Jul-2019 22:30:24

265 Views

The advancement of social media has introduced many terms to us. Some of those terms are sharing, blogging and publishing. Let us understand what do they mean.BloggingBlogging is one of them. Blogs are the pages where you can create the content and can share with the world. Writing your content in blogs is called Blogging. This content can be anything like stories, experiences, reviews, opinions, criticisms, explanations, etc. whichever you want to share with the world. The famous blogging site is blogspot.comPublishingPublishing is posting the content on to your blog page. By clicking this Publish, you are finalizing your content ... Read More

Writing Style of Wordsworth vs Coleridge

Ridhi Arora
Updated on 30-Jul-2019 22:30:24

3K+ Views

Both, Wordsworth and Coleridge were famous poets of their time, but both received praise for their own distinct writing styles.ColeridgeSamuel Taylor Coleridge is a popular name among Romantic poets who were influenced by the French Revolution. He was a leader of the British Romantic movement and was born on October 21, 1772, in Devonshire, England.Features of Coleridge’s PoetryTreatment of the Supernatural: He treats the supernatural in such a manner that it becomes convincing and at the same time, in some sense, a criticism of life.Suspension of Disbelief: The way in which Coleridge has achieved the willing suspension of disbelief has ... Read More

Other Expressions for the Word Amazing

Vihan Rodrigues
Updated on 30-Jul-2019 22:30:24

257 Views

Stop using ‘Amazing’ and end up being considered an amateur! Rather, try these expressions instead and get labelled as seasoned.AdorableAlluringAmbrosialAstonishingAstoundingAwe-InspiringAwesomeBeauteousBeautifulBewitchingBeyond WordsBlue-ribbonBonnyBreathtakingBrilliantCapitalCaptivatingCharmingClassyDarlingDauntingDazzlingDelectableDelicateDeliciousDelightfulDevineElegantEnchantingEnthrallingEnticingEtherealExaltedExcellentExceptionalExhilaratingExquisiteExtraordinaryFabulous (absolutely, dahling!)FantasticFascinatingFearsomeFetchingFirst-classFirst-rateGloriousGorgeousGracefulGrandHeavenlyIdealImpressiveIncomparableInconceivable (for my fellow Princess Bride fans)IncredibleIndescribableIneffableInspiringIrresistibleLovelyLusciousMagneticMagnificentMajesticMarvelousMesmerizingOutstandingProdigiousRadiantRapturousRavishingRefinedResplendentSavoryScrumptiousSensualSexyShockingSpectacularSplendidStaggeringStrikingStunningStupefyingSublimeSuperbSupremeSurprisingTantalizingThrillingTop-notchTranscendentTremendousUnbelievableUnearthlyUnutterableUpliftingWonderfulWondrousYummyAnd, if you totally amazed then this one.... (+_ +)Amazeballs

Get First and Last Elements from Vector in Java

Vikyath Ram
Updated on 30-Jul-2019 22:30:24

659 Views

The first element in the Vector can be obtained using the java.util.Vector.firstElement() method. The last element in the Vector can be obtained using the java.util.Vector.lastElement() method. Neither of these methods requires any parameters.A program that demonstrates this is given as follows:Example Live Demoimport java.util.Vector; public class Demo { public static void main(String args[]) { Vector vec = new Vector(); vec.add(4); vec.add(7); vec.add(2); vec.add(8); ... Read More

Use find to Find Multiple Subsequences in Java

Jai Janardhan
Updated on 30-Jul-2019 22:30:24

163 Views

The find() method finds the multiple subsequences in an input sequence that matches the pattern required. This method is available in the Matcher class that is available in the java.util.regex packageA program that uses the find() method to find multiple subsequence in Java is given as follows:Example Live Demoimport java.util.regex.Matcher; import java.util.regex.Pattern; public class Demo {    public static void main(String args[]) {       Pattern p = Pattern.compile("the");       Matcher m = p.matcher("eclipses of the sun and the moon");       System.out.println("Subsequence: the");       System.out.println("Sequence: eclipses of the sun and the moon");   ... Read More

Tragedy Depicted in the Book King Lear

Ridhi Arora
Updated on 30-Jul-2019 22:30:24

635 Views

Shakespeare is one of the greatest of all writers. He is the one who is remembered for only the magnanimity and grandeur of his works. The works of Shakespeare can be divided into three stages - historical, comedies, and tragedies. Out of the tragedies, King Lear is a melancholic tragedy written in 1605.Features of TragedyThe hero has a terrible flaw.The mood of foreboding follows the play.Hero has experiences of providence not favoring him.The end is usually the death of one or more people as a part of the play.If not death, there is a downfall of the hero which may ... Read More

Advertisements