Sreemaha

Sreemaha

51 Articles Published

Articles by Sreemaha

Page 5 of 6

How to declare a constructor in Java?

Sreemaha
Sreemaha
Updated on 19-Feb-2020 1K+ Views

While declaring the constructors you should keep the following points in mind.A constructor does not have a return type.The name of the constructor is same as the name of the class. A class can have more than one constructor.Examplepublic class Sample {    int num;    public Sample() {       num = 30;    }    public Sample(int value) {       num = value;    } }

Read More

How do you find out which sequence number was assigned recently by MySQL AUTO_INCREMENT?

Sreemaha
Sreemaha
Updated on 30-Jan-2020 509 Views

Last_Insert_Id() MySQL function is used to find out which sequence number was assigned recently by AUTO_INCREMENT.Examplemysql> Create table Employee(Id INT PRIMARY KEY NOT NULL AUTO_INCREMENT, Name Varchar(5)); Query OK, 0 rows affected (0.13 sec) mysql> Insert into Employee(Name) Values('Harvinder'); Query OK, 1 row affected (0.06 sec) mysql> Insert into Employee(Name) Values('Suresh'); Query OK, 1 row affected (0.07 sec) mysql> Select* from Employee; +----+---------+ | Id | Name    | +----+---------+ | 1  |Harvinder| | 2  | Suresh  | +----+---------+ 2 rows in set (0.00 sec) mysql> Select Last_insert_id(); +------------------+ | Last_insert_id() | +------------------+ |                2 | +------------------+ 1 row in set (0.00 sec)

Read More

How to use MySQL FROM_UNIXTIME() function to return datetime value in numeric format?

Sreemaha
Sreemaha
Updated on 30-Jan-2020 350 Views

As we know that we can convert a time of datetime value to an integer by adding 0(+0) to them. In a similar way, we can convert the datetime value returned by FROM_UNIXTIME() function in numeric format. The following example will clarify it more −mysql> Select FROM_UNIXTIME(1555033470)+0 AS 'Date in Numeric Format'; +------------------------+ | Date in Numeric Format | +------------------------+ | 20190412071430.000000  | +------------------------+ 1 row in set (0.00 sec)After adding 0 (+0) to datetime value MySQL returns the numeric value up to 6 digits microseconds.

Read More

How many digits should be there in string or number so that it can be specified as a date value by MySQL?

Sreemaha
Sreemaha
Updated on 29-Jan-2020 189 Views

While considering the year as 4-digit value, minimum of 8 digits in a string or number is required for MySQL to specify it as a date value. In this case, if we also want to store microseconds then the value can be up to a maximum of 20 digits.mysql> Select TIMESTAMP('20171022040536.100000'); +-----------------------------------+ | TIMESTAMP('20171022040536100000') | +-----------------------------------+ | 2017-10-22 04:05:36.100000        | +-----------------------------------+ 1 row in set, 1 warning (0.00 sec)The query above is taking 20 digits string for TIMESTAMP value. Last 6 digits are for microseconds.mysql> Select TIMESTAMP(20171022); +---------------------+ | TIMESTAMP(20171022) | +---------------------+ | 2017-10-22 00:00:00 | +---------------------+ ...

Read More

How to get the first day of the previous month in MySQL?

Sreemaha
Sreemaha
Updated on 29-Jan-2020 3K+ Views

With the help of following MySQL query, we can get the first day of previous month −mysql> SELECT DATE_FORMAT(CURDATE() - INTERVAL 1 MONTH,'%Y-%m-01') AS 'FIRST DAY OF PREVOIUS MONTH'; +-----------------------------+ | FIRST DAY OF PREVOIUS MONTH | +-----------------------------+ | 2017-09-01                  | +-----------------------------+ 1 row in set (0.00 sec)

Read More

In MySQL, why a client cannot use a user-defined variable defined by another client?

Sreemaha
Sreemaha
Updated on 30-Jul-2019 343 Views

In MySQL, a user-defined variable defined by one client cannot be seen or used by another client because user-defined variables are connection-specific. It means that all variables for a given client connection are automatically freed when that client exits

Read More

How to convert List to int[] in Java?

Sreemaha
Sreemaha
Updated on 30-Jul-2019 1K+ Views

You can simply iterate through list and fill the array as shown below −import java.util.ArrayList; import java.util.List; public class Tester {    public static void main(String[] args) {       List list = new ArrayList();       list.add(new Integer(1));       list.add(new Integer(2));       list.add(new Integer(3));       list.add(new Integer(4));       int[] array = new int[list.size()];       for(int i=0;i

Read More

Loading messages from Excel to SAP table T100

SAP
Sreemaha
Sreemaha
Updated on 30-Jul-2019 600 Views

You can use built-in translation tool in SAP system that collects short text of message classes, export to an excel file and then you can reimport the translations.With the use of Transaction LXE_Master, you can import the translations of short texts and PDF forms that have previously been exported for offline translation. During import you can create proposals in the proposal pool.It is also possible to create application standards or system standards and you can assign a quality status to the proposals. Call T-Code: LXE_MASTERNavigate to Transport -> Externalization -> Import and this will open the Import Translation Objects screen.In the ...

Read More

What is the difference between javac, java commands?

Sreemaha
Sreemaha
Updated on 30-Jul-2019 8K+ Views

The javac command is used to compile Java programs, it takes .java file as input and produces bytecode. Following is the syntax of this command. >javac sample.java The java command is used to execute the bytecode of java. It takes byte code as input and runs it and produces the output. Following is the syntax of this command. >java sample Let us consider an example create a Sample Java program with name Sample.java Sample.java public class Sample { public static void main(String args[]) { System.out.println("Hi welcome ...

Read More

What is meant by Java being an architecture neutral language?

Sreemaha
Sreemaha
Updated on 30-Jul-2019 5K+ Views

Unlike many other programming languages including C and C++, when Java is compiled, it is not compiled into platform specific machine, rather into platform-independent byte code. This byte code is distributed over the web and interpreted by the Virtual Machine (JVM) on whichever platform it is being run on. Thus when you write a piece of Java code in a particular platform and generated an executable code .class file. You can execute/run this .class file on any system the only condition is that the target system should have JVM (JRE) installed in it. In short, Java compiler generates an architecture-neutral ...

Read More
Showing 41–50 of 51 articles
Advertisements